All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Dmitry Frolov <frolov@swemel.ru>
Cc: hreitz@redhat.com, qemu-block@nongnu.org,
	sdl.qemu@linuxtesting.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] block/monitor: blk_bs() return value check
Date: Fri, 24 Nov 2023 14:06:38 +0100	[thread overview]
Message-ID: <ZWCf3hoaNHaWNECw@redhat.com> (raw)
In-Reply-To: <20231124113037.2477645-1-frolov@swemel.ru>

Am 24.11.2023 um 12:30 hat Dmitry Frolov geschrieben:
> blk_bs() may return NULL, which will be dereferenced without a check in
> bdrv_commit().
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Frolov <frolov@swemel.ru>

Do you have a reproducer for a crash?

As far as I can see, it will not be dereferenced, because
blk_is_available() returns false and we return an error before
calling bdrv_commit():

    QEMU 8.1.91 monitor - type 'help' for more information
    (qemu) info block
    ide1-cd0: [not inserted]
        Attached to:      /machine/unattached/device[6]
        Removable device: not locked, tray closed

    floppy0: [not inserted]
        Attached to:      /machine/unattached/device[16]
        Removable device: not locked, tray closed

    sd0: [not inserted]
        Removable device: not locked, tray closed
    (qemu) commit ide1-cd0 
    Device 'ide1-cd0' has no medium

Kevin



  reply	other threads:[~2023-11-24 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 11:30 [PATCH] block/monitor: blk_bs() return value check Dmitry Frolov
2023-11-24 13:06 ` Kevin Wolf [this message]
2023-11-24 14:05   ` Дмитрий Фролов
2023-11-24 16:49     ` Kevin Wolf

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=ZWCf3hoaNHaWNECw@redhat.com \
    --to=kwolf@redhat.com \
    --cc=frolov@swemel.ru \
    --cc=hreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sdl.qemu@linuxtesting.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.