xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl handling
@ 2016-07-07  7:40 Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2016-07-07  7:40 UTC (permalink / raw)
  To: Roger Pau Monne, Konrad Rzeszutek Wilk; +Cc: xen-devel, linux-kernel

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",




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-07 10:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <577E23A602000078000FBE15@prv-mh.provo.novell.com>
2016-07-07  9:32 ` [PATCH] xen-blkfront: avoid NULL de-reference in CDROM ioctl handling Roger Pau Monne
2016-07-07  9:42   ` Jan Beulich
2016-07-07 10:56     ` Roger Pau Monne
2016-07-07  7:40 Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).