mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] opp: Fix use-after-free in lazy_opp_tables after probe deferral
Date: Tue, 30 May 2023 18:47:11 +0200	[thread overview]
Message-ID: <ZHYoj7NHKVIpUceK@kernkonzept.com> (raw)
In-Reply-To: <20230530091330.e3nawo6ey2an4ir2@vireshk-i7>

On Tue, May 30, 2023 at 02:43:30PM +0530, Viresh Kumar wrote:
> On 30-05-23, 10:31, Stephan Gerhold wrote:
> > Thanks, this seems to fix the crash as well. Are you going to handle it
> > or should I send a v2 with this diff?
> 
> Please send a V2 :)
> 

Done!

> > During _allocate_opp_table() it's accessed without the opp_table_lock,
> > because of
> > 
> > 	/* Drop the lock to reduce the size of critical section */
> > 	mutex_unlock(&opp_table_lock);
> > 
> > 	if (opp_table) {
> > 		/* ... */
> > 		mutex_lock(&opp_table_lock);
> > 	} else {
> > 		opp_table = _allocate_opp_table(dev, index);
> > 
> > 		mutex_lock(&opp_table_lock);
> > 		/* ... */
> > 	}
> > 
> > This doesn't seem to cause any problems in my case though so it's
> > unrelated to the crash I observed.
> 
> Hmm, right. Maybe we need a lock for that list, want to take that up ?
> 

Yeah, a lock would probably be good to be safe. I would appreciate if
you or someone else could create a patch for this though, since I'm not
too familiar with the overall OPP implementation. I would be happy to
test that it works properly for my apparently quite special use case
(I have several OPP tables with interconnects and required-opps).

Thanks!
Stephan
-- 
Kernkonzept GmbH at Dresden, Germany, HRB 31129, CEO Dr.-Ing. Michael Hohmuth

      reply	other threads:[~2023-05-30 16:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 17:56 Stephan Gerhold
2023-05-29  5:31 ` Viresh Kumar
2023-05-30  8:31   ` Stephan Gerhold
2023-05-30  9:13     ` Viresh Kumar
2023-05-30 16:47       ` Stephan Gerhold [this message]

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=ZHYoj7NHKVIpUceK@kernkonzept.com \
    --to=stephan.gerhold@kernkonzept.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@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

all inboxes | Powered by JetHome®