[lustre-devel] [PATCH 8/9] lustre: ensure libcfs is set up for ioctls.

James Simmons jsimmons at infradead.org
Sun Jul 29 10:30:38 PDT 2018


> libcfs only allocated various buffers when libcfs_setup()
> is called.
> This should be called before any significant libcfs related
> activity.  However it isn't called by libcfs_ioctl().
> So if the first thing that happens is an ioctl, tracing can cause
> NULL pointer dereferences.

Reviewed-by: James Simmons <jsimmons at infradead.org>
 
> Fixes: 64bf0b1a079d ("staging: lustre: refactor libcfs initialization.")
> Signed-off-by: NeilBrown <neilb at suse.com>
> ---
>  drivers/staging/lustre/lnet/libcfs/module.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c
> index ad654b56814d..bfadfcfa3c44 100644
> --- a/drivers/staging/lustre/lnet/libcfs/module.c
> +++ b/drivers/staging/lustre/lnet/libcfs/module.c
> @@ -206,6 +206,9 @@ static int libcfs_ioctl(unsigned long cmd, void __user *uparam)
>  	struct libcfs_ioctl_hdr *hdr;
>  	int err;
>  
> +	err = libcfs_setup();
> +	if (err)
> +		return err;
>  	/* 'cmd' and permissions get checked in our arch-specific caller */
>  	err = libcfs_ioctl_getdata(&hdr, uparam);
>  	if (err) {
> 
> 
> 


More information about the lustre-devel mailing list