[kernel/f17] Add patch to fix w1_search oops (rhbz 857954)

Josh Boyer jwboyer at fedoraproject.org
Mon Mar 11 13:18:07 UTC 2013


commit 053e021c3a6285b7e09eb6d7a4950e2da2c9549e
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Mon Mar 11 09:15:31 2013 -0400

    Add patch to fix w1_search oops (rhbz 857954)

 kernel.spec                                     |    7 ++
 w1-fix-oops-when-w1_search-is-called-from.patch |  111 +++++++++++++++++++++++
 2 files changed, 118 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 7ac3840..4bef27a 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -766,6 +766,9 @@ Patch24103: turbostat-makefile.diff
 #rhbz 904182
 Patch24104: TTY-do-not-reset-master-s-packet-mode.patch
 
+#rhbz 857954
+Patch24105: w1-fix-oops-when-w1_search-is-called-from.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1490,6 +1493,9 @@ ApplyPatch turbostat-makefile.diff
 #rhbz 904182
 ApplyPatch TTY-do-not-reset-master-s-packet-mode.patch
 
+#rhbz 857954
+ApplyPatch w1-fix-oops-when-w1_search-is-called-from.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2347,6 +2353,7 @@ fi
 #              '-'
 %changelog
 * Mon Mar 11 2013 Josh Boyer <jwboyer at redhat.com>
+- Add patch to fix w1_search oops (rhbz 857954)
 - Add patch to fix broken tty handling (rhbz 904182)
 
 * Fri Mar 08 2013 Josh Boyer <jwboyer at redhat.com>
diff --git a/w1-fix-oops-when-w1_search-is-called-from.patch b/w1-fix-oops-when-w1_search-is-called-from.patch
new file mode 100644
index 0000000..0a54eff
--- /dev/null
+++ b/w1-fix-oops-when-w1_search-is-called-from.patch
@@ -0,0 +1,111 @@
+                                                                                                                                                                                                                                                               
+Delivered-To: jwboyer at gmail.com
+Received: by 10.101.212.35 with SMTP id o35csp6769anq;
+        Sat, 2 Mar 2013 05:50:51 -0800 (PST)
+X-Received: by 10.68.137.42 with SMTP id qf10mr19122124pbb.80.1362232251119;
+        Sat, 02 Mar 2013 05:50:51 -0800 (PST)
+Return-Path: <linux-kernel-owner at vger.kernel.org>
+Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67])
+        by mx.google.com with ESMTP id pu7si8560937pbc.232.2013.03.02.05.50.50;
+        Sat, 02 Mar 2013 05:50:51 -0800 (PST)
+Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner at vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67;
+Authentication-Results: mx.google.com;
+       spf=pass (google.com: best guess record for domain of linux-kernel-owner at vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mail=linux-kernel-owner at vger.kernel.org;
+       dkim=neutral (body hash did not verify) header.i=@gmail.com
+Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand
+	id S1752198Ab3CBNuU (ORCPT <rfc822;bloodsquadron at gmail.com>
+	+ 99 others); Sat, 2 Mar 2013 08:50:20 -0500
+Received: from mail-ee0-f48.google.com ([74.125.83.48]:46431 "EHLO
+	mail-ee0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+	with ESMTP id S1752038Ab3CBNuT (ORCPT
+	<rfc822;linux-kernel at vger.kernel.org>);
+	Sat, 2 Mar 2013 08:50:19 -0500
+Received: by mail-ee0-f48.google.com with SMTP id t10so2921534eei.7
+        for <linux-kernel at vger.kernel.org>; Sat, 02 Mar 2013 05:50:18 -0800 (PST)
+DKIM-Signature:	v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=gmail.com; s=20120113;
+        h=x-received:date:from:to:cc:subject:message-id:references
+         :mime-version:content-type:content-disposition:in-reply-to
+         :user-agent;
+        bh=8ABPYEMGQsyhtGtpdGpnD1kQchBrqYm9rJ3sEUcIQOc=;
+        b=hx/4GjbvaME9C3c+WOrfUkkwnJ5jJXefsOhCKmPCE8kmswk3Tvm11198r4+y1jM/Bl
+         1wtIYby6sFgA08JUldm09fPpsKfbdeDnFAI5WmUAGJjahFXXRrQPocI6E0+s2BcM+t3H
+         Ii8g8ZvYJ+YMgbbSmp7mwMv98aa0+qdY6TIF4P/wNwAWrsjFh5TBgc/QyB0MzyQQ2tMp
+         LfA7n/2sH11vofS6FLSaWhtwGIIexPZ+oxWpvwBcCIYX+gTrSHPZqnLQkvhQ5oZDx7WF
+         6QlNEqlmL+usW1ApRCAwcL4jOaORDAC2MytGH4jdZNic0PqdzonfbJTRE6YmZ45FHtNG
+         l+6w==
+X-Received: by 10.15.101.204 with SMTP id bp52mr38431150eeb.31.1362232218031;
+        Sat, 02 Mar 2013 05:50:18 -0800 (PST)
+Received: from gmail.com (aek101.neoplus.adsl.tpnet.pl. [83.25.114.101])
+        by mx.google.com with ESMTPS id o3sm22363368eem.15.2013.03.02.05.50.16
+        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
+        Sat, 02 Mar 2013 05:50:17 -0800 (PST)
+Date:	Sat, 2 Mar 2013 14:50:15 +0100
+From:	Marcin Jurkowski <marcin1j at gmail.com>
+To:	Sven Geggus <lists at fuchsschwanzdomain.de>
+Cc:	Evgeniy Polyakov <zbr at ioremap.net>, linux-kernel at vger.kernel.org
+Subject: [PATCH 1/1] w1: fix oops when w1_search is called from netlink
+ connector
+Message-ID: <20130302135015.GA21448 at gmail.com>
+References: <20130116141627.GA23638 at ioremap.net>
+ <20130302001103.GB18026 at gmail.com>
+ <20130302094510.GA4695 at geggus.net>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20130302094510.GA4695 at geggus.net>
+User-Agent: Mutt/1.5.21 (2010-09-15)
+Sender:	linux-kernel-owner at vger.kernel.org
+Precedence: bulk
+List-ID: <linux-kernel.vger.kernel.org>
+X-Mailing-List:	linux-kernel at vger.kernel.org
+
+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 at 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 at 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
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
+the body of a message to majordomo at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
+Please read the FAQ at  http://www.tux.org/lkml/


More information about the scm-commits mailing list