From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Vasilis Liaskovitis <vliaskovitis@suse.com>
Cc: <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
<linux-block@vger.kernel.org>, <jgross@suse.com>,
<axboe@kernel.dk>, <konrad.wilk@oracle.com>,
<boris.ostrovsky@oracle.com>
Subject: Re: [Xen-devel] [PATCH] xen/blkfront: avoid NULL blkfront_info dereference on device removal
Date: Thu, 11 Oct 2018 18:34:27 +0200 [thread overview]
Message-ID: <20181011163427.ilpsl4hxb2y3hcfp@mac.bytemobile.com> (raw)
In-Reply-To: <20181011162000.19191-1-vliaskovitis@suse.com>
On Thu, Oct 11, 2018 at 06:20:00PM +0200, Vasilis Liaskovitis wrote:
> If a block device is hot-added when we are out of grants,
> gnttab_grant_foreign_access fails with -ENOSPC (log message "28
> granting access to ring page") in this code path:
>
> talk_to_blkback ->
> setup_blkring ->
> xenbus_grant_ring ->
> gnttab_grant_foreign_access
>
> and the failing path in talk_to_blkback sets the driver_data to NULL:
>
> destroy_blkring:
> blkif_free(info, 0);
>
> mutex_lock(&blkfront_mutex);
> free_info(info);
> mutex_unlock(&blkfront_mutex);
>
> dev_set_drvdata(&dev->dev, NULL);
>
> This results in a NULL pointer BUG when blkfront_remove and blkif_free
> try to access the failing device's NULL struct blkfront_info.
>
> Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
> ---
> drivers/block/xen-blkfront.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 429d20131c7e..92cc6cb6b078 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -2493,6 +2493,9 @@ static int blkfront_remove(struct xenbus_device *xbdev)
>
> dev_dbg(&xbdev->dev, "%s removed", xbdev->nodename);
>
> + if (!info)
> + goto out;
I don't see the point in adding the 'out' label. Can you just return 0
here?
Thanks, Roger.
next parent reply other threads:[~2018-10-11 16:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181011162000.19191-1-vliaskovitis@suse.com>
2018-10-11 16:34 ` Roger Pau Monné [this message]
2018-10-15 8:55 ` Vasilis Liaskovitis
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=20181011163427.ilpsl4hxb2y3hcfp@mac.bytemobile.com \
--to=roger.pau@citrix.com \
--cc=axboe@kernel.dk \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vliaskovitis@suse.com \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®