[<prev] [next>] [day] [month] [year] [list]
Message-ID: <565DF3EE.7060309@cardoe.com>
Date: Tue, 1 Dec 2015 13:24:30 -0600
From: Doug Goldstein <cardoe@...doe.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org,
Bob Liu <bob.liu@...cle.com>,
Paul Durrant <paul.durrant@...rix.com>,
Wei Liu <wei.liu2@...rix.com>,
David Vrabel <david.vrabel@...rix.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Jonathan Creekmore <jonathan.creekmore@...il.com>
Subject: Re: [PATCH] xen-pciback: fix up cleanup path when alloc fails
On 12/1/15 10:47 AM, Konrad Rzeszutek Wilk wrote:
> On Thu, Nov 26, 2015 at 02:32:39PM -0600, Doug Goldstein wrote:
>> When allocating a pciback device fails, avoid the possibility of a
>> use after free.
>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
>
> Ugh, and it looks like xen-blkfront has the same issue.
I believe that case is covered because xen_blkbk_remove() is called in
all the failure cases of xen_blkbk_probe() in that case.
>
>>
>> Reported-by: Jonathan Creekmore <jonathan.creekmore@...il.com>
>> Signed-off-by: Doug Goldstein <cardoe@...doe.com>
>> ---
>> drivers/xen/xen-pciback/xenbus.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
>> index 98bc345..4843741 100644
>> --- a/drivers/xen/xen-pciback/xenbus.c
>> +++ b/drivers/xen/xen-pciback/xenbus.c
>> @@ -44,7 +44,6 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
>> dev_dbg(&xdev->dev, "allocated pdev @ 0x%p\n", pdev);
>>
>> pdev->xdev = xdev;
>> - dev_set_drvdata(&xdev->dev, pdev);
>>
>> mutex_init(&pdev->dev_lock);
>>
>> @@ -58,6 +57,9 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
>> kfree(pdev);
>> pdev = NULL;
>> }
>> +
>> + dev_set_drvdata(&xdev->dev, pdev);
>> +
>> out:
>> return pdev;
>> }
>> --
>> 2.4.10
>>
--
Doug Goldstein
Download attachment "signature.asc" of type "application/pgp-signature" (960 bytes)
Powered by blists - more mailing lists