From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Pali Rohár" <pali@kernel.org>
Cc: Michal Wilczynski <michal.wilczynski@intel.com>,
linux-acpi@vger.kernel.org, rafael@kernel.org,
ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com,
markgross@kernel.org, fengguang.wu@intel.com,
dvhart@linux.intel.com, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] platform/x86/dell/dell-rbtn: Fix resources leaking on error path
Date: Tue, 13 Jun 2023 00:02:25 +0300 [thread overview]
Message-ID: <ZIeH4e8icEEAD3Gc@smile.fi.intel.com> (raw)
In-Reply-To: <20230612205839.wxo2h2ahqcdo73rc@pali>
On Mon, Jun 12, 2023 at 10:58:39PM +0200, Pali Rohár wrote:
> On Monday 12 June 2023 23:52:30 Andy Shevchenko wrote:
> > On Mon, Jun 12, 2023 at 07:52:05PM +0200, Pali Rohár wrote:
> > > On Monday 12 June 2023 12:02:50 Michal Wilczynski wrote:
...
> > > Hello! I'm looking at rbtn_add() function and there is also code:
> > >
> > > rbtn_data = devm_kzalloc(&device->dev, sizeof(*rbtn_data), GFP_KERNEL);
> > > if (!rbtn_data)
> > > return -ENOMEM;
> > >
> > > which is called after rbtn_acquire(). So it looks like when kzalloc
> > > fails then there is another leak...
> >
> > Side note: In that case we would need a devm wrapper on acquire call.
>
> Does it makes sense to invest time and more resources for these fixes?
> Driver is not used on new Dell machines, so I would not expect new
> users (instead less users, if they start upgrading HW to new Dell
> machines).
>
> Simple fix for this issue: Just move devm_kzalloc() call before
> rbtn_acquire(true). And call cleanup rbtn_acquire(false) exactly like
> Michal did in this patch.
>
> I think that this should be enough, should cover all failure paths and
> does not require to introduce new code or new design, which should be
> properly tested for no regression.
>
> What do you think?
Sounds like a good alternative! Thank you for the review.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-06-12 21:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 9:02 [PATCH v1] platform/x86/dell/dell-rbtn: Fix resources leaking on error path Michal Wilczynski
2023-06-12 11:21 ` Rafael J. Wysocki
2023-06-12 17:52 ` Pali Rohár
2023-06-12 20:52 ` Andy Shevchenko
2023-06-12 20:58 ` Pali Rohár
2023-06-12 21:02 ` Andy Shevchenko [this message]
2023-06-13 9:28 ` Ilpo Järvinen
2023-06-13 9:57 ` Wilczynski, Michal
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=ZIeH4e8icEEAD3Gc@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=dvhart@linux.intel.com \
--cc=fengguang.wu@intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=michal.wilczynski@intel.com \
--cc=pali@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.