2012-07-13 08:38:44

by Zefir Kurtisi

[permalink] [raw]
Subject: [PATCH] compat: fix system crash on 2.6.35 when flushing work

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 <[email protected]>
---
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);
--
1.7.4.1



2012-07-18 15:24:44

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH] compat: fix system crash on 2.6.35 when flushing work

On Fri, Jul 13, 2012 at 1:38 AM, Zefir Kurtisi
<[email protected]> 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 <[email protected]>

Thanks! Applied and pushed and I'll roll this into the stable series
as well and make a new set of releases where this is applicable today.

Luis

2012-08-13 11:15:24

by Zefir Kurtisi

[permalink] [raw]
Subject: Re: [PATCH] compat: fix system crash on 2.6.35 when flushing work

On 08/12/2012 06:19 PM, C. McPherson wrote:
> Zefir:
> Thanks a lot for this reference. All my systems are running Ubuntu
> 10.04/10.10. I was updating our compat-wireless with the stable
> compat-wireless 3.5
> and came across this crash in our testing lab. I added your patch and
> the stable compat-wireless 3.5 is now working with our Ubuntu.
>
> -Tex
>
>
Hi Tex,

the fix Hauke provided is the correct one. The QH I posted was a lucky
punch that for some reason prevented the system crashing without
resolving the issue.



2012-08-12 17:20:03

by C. McPherson

[permalink] [raw]
Subject: Re: [PATCH] compat: fix system crash on 2.6.35 when flushing work

Zefir:
Thanks a lot for this reference. All my systems are running Ubuntu
10.04/10.10. I was updating our compat-wireless with the stable
compat-wireless 3.5
and came across this crash in our testing lab. I added your patch and
the stable compat-wireless 3.5 is now working with our Ubuntu.

-Tex


On 07/13/2012 04:38 AM, 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 <[email protected]>
> ---
> 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);


2012-08-07 17:47:23

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH] compat: fix system crash on 2.6.35 when flushing work

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 <[email protected]>
> ---
> 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" <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>

And then applies the 2 upstream commits:

>From 78fda91b330657f1d66afc32d18cae99f4783f21 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <[email protected]>
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 <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>

>From 19041dd7befe97f476c187bc15442cd738c67f37 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <[email protected]>
Date: Tue, 7 Aug 2012 00:36:20 +0200

compat: fix undef syntax

Signed-off-by: Hauke Mehrtens <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>

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 <[email protected]>
---
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);
--
1.7.10.4