From: Laszlo Ersek <lersek@redhat.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL
Date: Wed, 25 May 2011 12:24:25 +0200 [thread overview]
Message-ID: <4DDCD8D9.2060404@redhat.com> (raw)
...because vbd_size() dereferences bd_disk if bd_part is NULL.
Signed-off-by: Laszlo Ersek<lersek@redhat.com>
---
drivers/xen/blkback/vbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff -r 415a9b435fef drivers/xen/blkback/vbd.c
--- a/drivers/xen/blkback/vbd.c Mon May 23 18:36:33 2011 +0100
+++ b/drivers/xen/blkback/vbd.c Wed May 25 12:15:26 2011 +0200
@@ -73,7 +73,6 @@ int vbd_create(blkif_t *blkif, blkif_vde
}
vbd->bdev = bdev;
- vbd->size = vbd_size(vbd);
if (vbd->bdev->bd_disk == NULL) {
DPRINTK("vbd_creat: device %08x doesn't exist.\n",
@@ -82,6 +81,8 @@ int vbd_create(blkif_t *blkif, blkif_vde
return -ENOENT;
}
+ vbd->size = vbd_size(vbd);
+
if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
vbd->type |= VDISK_CDROM;
if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE)
next reply other threads:[~2011-05-25 10:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 10:24 Laszlo Ersek [this message]
2011-05-25 10:36 ` [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL Jan Beulich
2011-05-25 13:01 ` Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DDCD8D9.2060404@redhat.com \
--to=lersek@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).