[RFC PATCH] extcon: Fix sleeping in atomic context

From: Krzysztof Kozlowski
Date: Fri Sep 26 2014 - 07:51:10 EST


Hi,

When kernel was built with charger manager and extcon, I encountered
a sleep in atomic context after connecting USB cable to the device.

I found this on internal kernel 3.16 on Exynos3250 development board.
Unfortunately I could not reproduce it on mainline kernel because
none of my boards were able to bring up full charging stack
(fuel gauge, charger, charger-manager, extcon).

However, after looking at source code, this should happen also on
mainline kernel.

The fix for bug is simple - use mutexes instead of spin locks. It was
tested on 3.16 but *should* work on mainline.

My questions/request for comments are:
1. Could someone verify this on mainline (test it)?
2. Should I mark it cc-stable? I think yes *but* the patch changes
few extcon functions from non-sleeping to might_sleep.
On mainline these affected functions are not used in atomic
contexts but I am not sure about older stable kernels.
Applying this to older kernel could lead to another sleep-in-atomic
issue...


Any comments?

Best regards,
Krzysztof

Krzysztof Kozlowski (1):
extcon: Fix sleeping in atomic context after connecting USB cable

drivers/extcon/extcon-class.c | 15 ++++++++-------
include/linux/extcon.h | 3 ++-
2 files changed, 10 insertions(+), 8 deletions(-)

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/