From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
"Juergen Gross" <jgross@suse.com>,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: xen-blkback: add null check to avoid null pointer dereference
Date: Mon, 15 May 2017 17:18:44 -0400 [thread overview]
Message-ID: <20170515211844.GA17662@char.us.oracle.com> (raw)
In-Reply-To: <20170511152735.GA4409@embeddedgus>
On Thu, May 11, 2017 at 10:27:35AM -0500, Gustavo A. R. Silva wrote:
> Add null check before calling xen_blkif_put() to avoid potential
> null pointer dereference.
>
Applied to 'stable/for-jens-4.12' and will push soon to Jens.
> Addresses-Coverity-ID: 1350942
> Cc: Juergen Gross <jgross@suse.com>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> drivers/block/xen-blkback/xenbus.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index 8fe61b5..1f3dfaa 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -504,11 +504,13 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
>
> dev_set_drvdata(&dev->dev, NULL);
>
> - if (be->blkif)
> + if (be->blkif) {
> xen_blkif_disconnect(be->blkif);
>
> - /* Put the reference we set in xen_blkif_alloc(). */
> - xen_blkif_put(be->blkif);
> + /* Put the reference we set in xen_blkif_alloc(). */
> + xen_blkif_put(be->blkif);
> + }
> +
> kfree(be->mode);
> kfree(be);
> return 0;
> --
> 2.5.0
>
prev parent reply other threads:[~2017-05-15 21:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 16:49 [block-xen-blkback] question about pontential null pointer dereference Gustavo A. R. Silva
2017-05-11 8:53 ` [Xen-devel] " Juergen Gross
2017-05-11 15:05 ` Gustavo A. R. Silva
2017-05-11 15:27 ` [PATCH] block: xen-blkback: add null check to avoid " Gustavo A. R. Silva
2017-05-15 21:18 ` Konrad Rzeszutek Wilk [this message]
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=20170515211844.GA17662@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=garsilva@embeddedor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roger.pau@citrix.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