From: Evgeniy Polyakov <zbr@ioremap.net>
To: Marcin Jurkowski <marcin1j@gmail.com>
Cc: Sven Geggus <lists@fuchsschwanzdomain.de>,
linux-kernel@vger.kernel.org, GregKH <greg@kroah.com>
Subject: Re: [PATCH 1/1] w1: fix oops when w1_search is called from netlink connector
Date: Mon, 4 Mar 2013 00:54:52 +0400 [thread overview]
Message-ID: <20130303205452.GA2064@ioremap.net> (raw)
In-Reply-To: <20130302135015.GA21448@gmail.com>
Hi
Marcin, thanks a lot for the fix, I have to sorry I'm not on this bug yet :(
Sven confirmed patch fixes it, Greg please pull it into your tree.
I believe this is stable material.
Thanks everyone.
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
On Sat, Mar 02, 2013 at 02:50:15PM +0100, Marcin Jurkowski (marcin1j@gmail.com) wrote:
> On Sat, Mar 02, 2013 at 10:45:10AM +0100, Sven Geggus wrote:
> > This is the bad commit I found doing git bisect:
> > 04f482faf50535229a5a5c8d629cf963899f857c is the first bad commit
> > commit 04f482faf50535229a5a5c8d629cf963899f857c
> > Author: Patrick McHardy <kaber@trash.net>
> > Date: Mon Mar 28 08:39:36 2011 +0000
>
> Good job. I was too lazy to bisect for bad commit;)
>
> Reading the code I found problematic kthread_should_stop call from netlink
> connector which causes the oops. After applying a patch, I've been testing
> owfs+w1 setup for nearly two days and it seems to work very reliable (no
> hangs, no memleaks etc).
> More detailed description and possible fix is given below:
>
> Function w1_search can be called from either kthread or netlink callback.
> While the former works fine, the latter causes oops due to kthread_should_stop
> invocation.
>
> This patch adds a check if w1_search is serving netlink command, skipping
> kthread_should_stop invocation if so.
>
> Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
> ---
> drivers/w1/w1.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index 7994d933..7e2220d 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -924,7 +924,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
> tmp64 = (triplet_ret >> 2);
> rn |= (tmp64 << i);
>
> - if (kthread_should_stop()) {
> + /* ensure we're called from kthread and not by netlink callback */
> + if (!dev->priv && kthread_should_stop()) {
> mutex_unlock(&dev->bus_mutex);
> dev_dbg(&dev->dev, "Abort w1_search\n");
> return;
> --
> 1.7.12.4
--
Evgeniy Polyakov
next prev parent reply other threads:[~2013-03-03 20:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 18:44 reproducible w1 oops on recent kernels (at least since 3.2.x) Sven Geggus
2013-01-16 14:16 ` Evgeniy Polyakov
2013-03-02 0:11 ` Marcin Jurkowski
2013-03-02 9:45 ` Sven Geggus
2013-03-02 13:50 ` [PATCH 1/1] w1: fix oops when w1_search is called from netlink connector Marcin Jurkowski
2013-03-03 15:36 ` Sven Geggus
2013-03-03 20:54 ` Evgeniy Polyakov [this message]
2013-03-03 22:41 ` GregKH
2013-03-11 13:18 ` Josh Boyer
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=20130303205452.GA2064@ioremap.net \
--to=zbr@ioremap.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@fuchsschwanzdomain.de \
--cc=marcin1j@gmail.com \
/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.