From patchwork Tue Aug 7 17:47:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 1287361 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 20AE9DF280 for ; Tue, 7 Aug 2012 17:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559Ab2HGRr1 (ORCPT ); Tue, 7 Aug 2012 13:47:27 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:28231 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755741Ab2HGRrX (ORCPT ); Tue, 7 Aug 2012 13:47:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1344361644; x=1375897644; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wNzKCAGkaNg0deZnUOmOhETSBn0VXGjKDo0wBSpRN8s=; b=PtQMY7rratTevpat3k05ue07SBWhhIedgNgNkf44Qa+yi/DdJ/KRVVdY GM1XQke3mWnsFi5VR9UJRIaTi1hWPargvVZkMnARg/dF/J1BmvU6QwLWY rzJjkh30x2th3rXraCPU+sMv31l2WQUhzczreaKULBuRPS7qhvrecHgfS 0=; X-IronPort-AV: E=McAfee;i="5400,1158,6796"; a="222125919" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine01.qualcomm.com with ESMTP; 07 Aug 2012 10:47:23 -0700 X-IronPort-AV: E=Sophos;i="4.77,728,1336374000"; d="scan'208";a="306989052" Received: from nasanexhc11.na.qualcomm.com ([172.30.39.6]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 07 Aug 2012 10:47:21 -0700 Received: from nasanexhc05.na.qualcomm.com (172.30.48.2) by nasanexhc11.na.qualcomm.com (172.30.39.6) with Microsoft SMTP Server (TLS) id 14.2.309.2; Tue, 7 Aug 2012 10:47:19 -0700 Received: from lenteja (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.2) with Microsoft SMTP Server (TLS) id 14.2.309.2; Tue, 7 Aug 2012 10:47:18 -0700 Received: by lenteja (sSMTP sendmail emulation); Tue, 07 Aug 2012 10:47:28 -0700 Date: Tue, 7 Aug 2012 10:47:28 -0700 From: "Luis R. Rodriguez" To: Zefir Kurtisi CC: , , , Subject: Re: [PATCH] compat: fix system crash on 2.6.35 when flushing work Message-ID: <20120807174728.GF3745@lenteja.do-not-panic.com> References: <1342168714-3361-1-git-send-email-zefir.kurtisi@neratec.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1342168714-3361-1-git-send-email-zefir.kurtisi@neratec.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [172.30.48.1] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, Jul 13, 2012 at 10:38:34AM +0200, Zefir Kurtisi wrote: > Ubuntu 10.10 stock kernel (2.6.35-22-generic) crashes in > compat_flush_scheduled_work(), that is called e.g. when > mac80211 module is unloaded. > > The problem was introduced with 80bf8a83 > compat: backport system work queues system_wq and system_long_wq > > The crash happens in compat_flush_scheduled_work() where both > flush_workqueue() and flush_scheduled_work() are called successively. > Removing one of them resolves the issue. > > All compat-wireless tarballs after 2012-03-18 are affected. > > Signed-off-by: Zefir Kurtisi > --- > compat/compat-2.6.36.c | 1 - > 1 files changed, 0 insertions(+), 1 deletions(-) > > diff --git a/compat/compat-2.6.36.c b/compat/compat-2.6.36.c > index 9190ecd..8f25be0 100644 > --- a/compat/compat-2.6.36.c > +++ b/compat/compat-2.6.36.c > @@ -140,7 +140,6 @@ void compat_flush_scheduled_work(void) > * go with the old kernel's one first for now (keventd_wq) and > * if think its reasonable later we can flip this around. > */ > - flush_workqueue(system_wq); > flush_scheduled_work(); > } > EXPORT_SYMBOL_GPL(compat_flush_scheduled_work); I've reverted this in favor for Hauke's fix. Although he did not revert your patch after inspecing his change it was apparant that the endless loop was really the issue. The backported fix is on the linux-3.5.y branch and the backported patch does a bit more justice to review the fix. I've load / unload tested this on v2.6.35. I kicked out a new v3.5 release based on this, the -3 release. From 5ea4da5f1e96fc1aba89b62290f0aaab0e943b0a Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Tue, 7 Aug 2012 09:19:08 -0700 Subject: [PATCH] compat: revert 4595ae7579bf17 (upstream 3da0495c) This reverts the commit: commit 4595ae7579bf177150d7a661644c852f7d549bfa Author: Zefir Kurtisi Date: Fri Jul 13 10:38:34 2012 +0200 compat: fix system crash on 2.6.35 when flushing work Upstream commit 3da0495cf863288b6798e121ccf93c4453c6c768 Ubuntu 10.10 stock kernel (2.6.35-22-generic) crashes in compat_flush_scheduled_work(), that is called e.g. when mac80211 module is unloaded. The problem was introduced with 80bf8a83 compat: backport system work queues system_wq and system_long_wq The crash happens in compat_flush_scheduled_work() where both flush_workqueue() and flush_scheduled_work() are called successively. Removing one of them resolves the issue. All compat-wireless tarballs after 2012-03-18 are affected. Signed-off-by: Zefir Kurtisi Signed-off-by: Luis R. Rodriguez And then applies the 2 upstream commits: From 78fda91b330657f1d66afc32d18cae99f4783f21 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 2 Aug 2012 18:28:01 +0200 compat: fix endless recursion in flush_scheduled_work The hader file defines flush_scheduled_work(a) compat_flush_scheduled_work(a), which causes flush_scheduled_work() and compat_flush_scheduled_work() to be the same function. With this patch it calls the actual function in the kernel. This fixes problems when unloading mac80211 from compat-wireless. Signed-off-by: Hauke Mehrtens Signed-off-by: Luis R. Rodriguez From 19041dd7befe97f476c187bc15442cd738c67f37 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 7 Aug 2012 00:36:20 +0200 compat: fix undef syntax Signed-off-by: Hauke Mehrtens Signed-off-by: Luis R. Rodriguez The real fix was to avoid the recursive call to flush_scheduled_work() by undef'ing it on the c file. Signed-off-by: Luis R. Rodriguez --- compat/compat-2.6.36.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/compat-2.6.36.c b/compat/compat-2.6.36.c index 8f25be0..72ada4a 100644 --- a/compat/compat-2.6.36.c +++ b/compat/compat-2.6.36.c @@ -133,6 +133,7 @@ int compat_schedule_delayed_work_on(int cpu, } EXPORT_SYMBOL_GPL(compat_schedule_delayed_work_on); +#undef flush_scheduled_work void compat_flush_scheduled_work(void) { /* @@ -140,6 +141,7 @@ void compat_flush_scheduled_work(void) * go with the old kernel's one first for now (keventd_wq) and * if think its reasonable later we can flip this around. */ + flush_workqueue(system_wq); flush_scheduled_work(); } EXPORT_SYMBOL_GPL(compat_flush_scheduled_work);