From: Tony Lindgren <tony@atomide.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] serial: core: don't kfree device managed data
Date: Tue, 6 Jun 2023 19:21:12 +0300 [thread overview]
Message-ID: <20230606162112.GM56720@atomide.com> (raw)
In-Reply-To: <ZH9IiAUeIf/pi+E1@smile.fi.intel.com>
* Andy Shevchenko <andriy.shevchenko@linux.intel.com> [230606 14:54]:
> On Tue, Jun 06, 2023 at 04:37:49PM +0300, Tony Lindgren wrote:
> > * Andy Shevchenko <andriy.shevchenko@linux.intel.com> [230606 13:16]:
> > > On Tue, Jun 06, 2023 at 11:26:25AM +0300, Dan Carpenter wrote:
> > > > The put_device() function will call serial_base_ctrl_release() or
> > > > serial_base_port_release() so these kfrees() are a double free bug.
>
> ...
>
> > > These labels are also called without device being even added.
> > > So, this is not good enough as far as I can tell.
> >
> > I guess you mean the possibe error returned from the call to
> > serial_base_device_init()?
> >
> > If serial_base_device_init() fails, we return error and end up doing
> > the put_device().
> >
> > We have serial_base_device_init() call device_initialize(), is that
> > not enough for put_device()?
>
> It's not. The error is returned when device release callback is not assigned
> yet.
OK thanks for clarifying.
> And also just noticed since we return deferred probe, the message there should
> be ratelimited or given only _once().
We should be OK with debug here like Dan suggested.
Regards,
Tony
next prev parent reply other threads:[~2023-06-06 16:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 8:26 [PATCH] serial: core: don't kfree device managed data Dan Carpenter
2023-06-06 12:28 ` Tony Lindgren
2023-06-06 13:17 ` Andy Shevchenko
2023-06-06 16:23 ` Tony Lindgren
2023-06-06 13:16 ` Andy Shevchenko
2023-06-06 13:37 ` Tony Lindgren
2023-06-06 14:54 ` Andy Shevchenko
2023-06-06 16:21 ` Tony Lindgren [this message]
2023-06-06 13:51 ` Dan Carpenter
2023-06-06 14:55 ` Andy Shevchenko
2023-06-06 15:01 ` Dan Carpenter
2023-06-06 16:18 ` Tony Lindgren
2023-06-14 4:46 ` Tony Lindgren
2023-06-14 6:37 ` Dan Carpenter
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=20230606162112.GM56720@atomide.com \
--to=tony@atomide.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-serial@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).