From: Dan Carpenter <dan.carpenter@oracle.com>
To: Johannes Thumshirn <jth@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andreas Werner <andreas.werner@men.de>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mcb: fix error handling in mcb_alloc_bus()
Date: Fri, 6 Aug 2021 16:37:00 +0300 [thread overview]
Message-ID: <20210806133700.GP22532@kadam> (raw)
In-Reply-To: <20210806133240.GQ1931@kadam>
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
next prev parent reply other threads:[~2021-08-06 13:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 9:18 [PATCH] mcb: fix error handling in mcb_alloc_bus() Dan Carpenter
2021-06-01 13:23 ` Johannes Thumshirn
2021-08-06 13:32 ` Dan Carpenter
2021-08-06 13:37 ` Dan Carpenter [this message]
2021-08-30 14:08 ` Dan Carpenter
2021-08-30 16:06 ` Johannes Thumshirn
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=20210806133700.GP22532@kadam \
--to=dan.carpenter@oracle.com \
--cc=andreas.werner@men.de \
--cc=gregkh@linuxfoundation.org \
--cc=jth@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).