Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1438441

Re: [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl handling

From Roger Pau Monne <roger.pau@citrix.com>
Newsgroups linux.kernel
Subject Re: [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl handling
Date 2016-07-07 11:40 +0200
Message-ID <rSdWN-55O-5@gated-at.bofh.it> (permalink)
References <rScem-3Vx-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jul 07, 2016 at 01:40:54AM -0600, Jan Beulich wrote:
> The ioctl can be called prior to full device setup having completed.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
>  drivers/block/xen-blkfront.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> --- 4.7-rc6-xen.orig/drivers/block/xen-blkfront.c
> +++ 4.7-rc6-xen/drivers/block/xen-blkfront.c
> @@ -496,12 +496,10 @@ static int blkif_ioctl(struct block_devi
>  				return -EFAULT;
>  		return 0;
>  
> -	case CDROM_GET_CAPABILITY: {
> -		struct gendisk *gd = info->gd;
> -		if (gd->flags & GENHD_FL_CD)
> +	case CDROM_GET_CAPABILITY:
> +		if (info->gd && (info->gd->flags & GENHD_FL_CD))

I don't follow how blkif_ioctl can be called with a NULL info->gd, because 
the set of file operations is set inside of info->gd->fops. And the disk 
should not be available until add_disk is called, which happens after having 
info->gd already set.

Roger.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl  handling "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 09:50 +0200
  Re: [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl  handling Roger Pau Monne <roger.pau@citrix.com> - 2016-07-07 11:40 +0200
    Re: [PATCH] xen-blkfront: avoid NULL de-reference in CDROM  ioctl handling "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 11:50 +0200
      Re: [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl  handling Roger Pau Monne <roger.pau@citrix.com> - 2016-07-07 13:00 +0200

csiph-web