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


Groups > linux.kernel > #1438247

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

From "Jan Beulich" <JBeulich@suse.com>
Newsgroups linux.kernel
Subject [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl handling
Date 2016-07-07 09:50 +0200
Message-ID <rScem-3Vx-29@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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))
 			return 0;
 		return -EINVAL;
-	}
 
 	default:
 		/*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n",

Back to linux.kernel | Previous | NextNext 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