From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758179AbdEOVTI (ORCPT ); Mon, 15 May 2017 17:19:08 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:27758 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbdEOVTH (ORCPT ); Mon, 15 May 2017 17:19:07 -0400 Date: Mon, 15 May 2017 17:18:44 -0400 From: Konrad Rzeszutek Wilk To: "Gustavo A. R. Silva" Cc: Roger Pau =?iso-8859-1?Q?Monn=E9?= , Juergen Gross , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] block: xen-blkback: add null check to avoid null pointer dereference Message-ID: <20170515211844.GA17662@char.us.oracle.com> References: <20170511100544.Horde.88c0RhMPEXYq42BauaUXfHV@gator4166.hostgator.com> <20170511152735.GA4409@embeddedgus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170511152735.GA4409@embeddedgus> User-Agent: Mutt/1.8.0 (2017-02-23) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Gustavo A. R. Silva > --- > 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 >