lkml.org 
[lkml]   [2021]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mcb: fix error handling in mcb_alloc_bus()
On Fri, Aug 06, 2021 at 04:32:40PM +0300, Dan Carpenter wrote:
> On Tue, Jun 01, 2021 at 03:23:55PM +0200, Johannes Thumshirn wrote:
> >
> >
> > Am 01.06.21 um 11:18 schrieb Dan Carpenter:
> > > There are two bugs:
> > > 1) If ida_simple_get() fails then this code calls put_device(carrier)
> > > but we haven't yet called get_device(carrier) and probably that
> > > leads to a use after free.
> > > 2) After device_initialize() then we need to use put_device() to
> > > release the bus. This will free the internal resources tied to the
> > > device and call mcb_free_bus() which will free the rest.
> > >
> > > Fixes: 5d9e2ab9fea4 ("mcb: Implement bus->dev.release callback")
> > > Fixes: 18d288198099 ("mcb: Correctly initialize the bus's device")
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > >
> >
> > Thanks applied
>
> I don't think this was actually applied and that's a good thing because
> my patch wasn't correct. It needs to call device_put() on both
> carrier and &bus->dev.
>
> I'm going to send a v2 fix for this.

Actually, no... My first patch was correct. Calling put_device(&bus->dev);
will call the release function which will put the carrier. My first
patch was correct.

:P

regards,
dan carpenter

\
 
 \ /
  Last update: 2021-08-06 15:38    [W:0.168 / U:1.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site