lkml.org 
[lkml]   [2016]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl handling
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",


\
 
 \ /
  Last update: 2016-07-07 10:21    [W:0.035 / U:1.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site