Re: [PATCH] xfs: Initialize label array properly
From: Darrick J. Wong
Date: Fri Aug 30 2019 - 01:39:55 EST
On Fri, Aug 30, 2019 at 02:37:07PM +0900, Austin Kim wrote:
> In case kernel stack variable is not initialized properly,
> there is a risk of kernel information disclosure.
>
> So, initialize 'char label[]' array with null characters.
Got a testcase for this? At least a couple other filesystems implement
this ioctl too, which means they all should be checked/tested on a
regular basis.
--D
> Signed-off-by: Austin Kim <austindh.kim@xxxxxxxxx>
> ---
> fs/xfs/xfs_ioctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 9ea5166..09b3bee 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -2037,7 +2037,7 @@ xfs_ioc_setlabel(
> char __user *newlabel)
> {
> struct xfs_sb *sbp = &mp->m_sb;
> - char label[XFSLABEL_MAX + 1];
> + char label[XFSLABEL_MAX + 1] = {0};
> size_t len;
> int error;
>
> --
> 2.6.2
>