All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PULL 2/6] block: Assert BlockDriver::format_name is not NULL
Date: Tue, 24 Mar 2020 13:20:40 +0100	[thread overview]
Message-ID: <20200324122044.1131326-3-mreitz@redhat.com> (raw)
In-Reply-To: <20200324122044.1131326-1-mreitz@redhat.com>

From: Philippe Mathieu-Daudé <philmd@redhat.com>

bdrv_do_find_format() calls strcmp() using BlockDriver::format_name
as argument, which must not be NULL. Assert this field is not null
when we register a block driver in bdrv_register().

Reported-by: Mansour Ahmadi <ManSoSec@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200318222235.23856-1-philmd@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block.c b/block.c
index a2542c977b..6b984dc883 100644
--- a/block.c
+++ b/block.c
@@ -363,6 +363,7 @@ char *bdrv_get_full_backing_filename(BlockDriverState *bs, Error **errp)
 
 void bdrv_register(BlockDriver *bdrv)
 {
+    assert(bdrv->format_name);
     QLIST_INSERT_HEAD(&bdrv_drivers, bdrv, list);
 }
 
-- 
2.25.1



  parent reply	other threads:[~2020-03-24 12:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 12:20 [PULL 0/6] Block patches for 5.0-rc0 Max Reitz
2020-03-24 12:20 ` [PULL 1/6] block: Avoid memleak on qcow2 image info failure Max Reitz
2020-03-24 12:20 ` Max Reitz [this message]
2020-03-24 12:20 ` [PULL 3/6] block: bdrv_set_backing_bs: fix use-after-free Max Reitz
2020-03-24 12:20 ` [PULL 4/6] block/qcow2: zero data_file child after free Max Reitz
2020-03-24 12:20 ` [PULL 5/6] iotests: Fix cleanup path in some tests Max Reitz
2020-03-24 12:20 ` [PULL 6/6] iotests/026: Move v3-exclusive test to new file Max Reitz
2020-03-24 14:52 ` [PULL 0/6] Block patches for 5.0-rc0 Peter Maydell

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=20200324122044.1131326-3-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.