Return-path: Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:28741 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384Ab3BBVzE (ORCPT ); Sat, 2 Feb 2013 16:55:04 -0500 Date: Sat, 02 Feb 2013 15:55:00 -0600 From: Larry Finger To: John W Linville Cc: linux-wireless@vger.kernel.org Subject: [PATCH] rtlwifi: Fix scheduling while atomic bug Message-ID: <510d8b34.btxtBUP/XZ2kqLoh%Larry.Finger@lwfinger.net> (sfid-20130202_225509_179148_C13444A1) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-wireless-owner@vger.kernel.org List-ID: Kernel commits 41affd5 and 6539306 changed the locking in rtl_lps_leave() from a spinlock to a mutex by doing the calls indirectly from a work queue to reduce the time that interrupts were disabled. This change was fine for most systems; however a scheduling while atomic bug was reported in https://bugzilla.redhat.com/show_bug.cgi?id=903881. The backtrace indicates that routine rtl_is_special(), which calls rtl_lps_leave() in three places was entered in atomic context. These direct calls are replaced by putting a request on the appropriate work queue. Signed-off-by: Larry Finger Reported-and-tested-by: Nathaniel Doherty Cc: Nathaniel Doherty Cc: Stanislaw Gruszka Cc: Stable --- John, If DaveM will still accept bug fixes for 3.8, please push this one. It is unlikely to have any side effects. Thanks, Larry --- base.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Index: wireless-testing-new/drivers/net/wireless/rtlwifi/base.c =================================================================== --- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/base.c +++ wireless-testing-new/drivers/net/wireless/rtlwifi/base.c @@ -1004,7 +1004,8 @@ u8 rtl_is_special_data(struct ieee80211_ is_tx ? "Tx" : "Rx"); if (is_tx) { - rtl_lps_leave(hw); + schedule_work(&rtlpriv-> + works.lps_leave_work); ppsc->last_delaylps_stamp_jiffies = jiffies; } @@ -1014,7 +1015,7 @@ u8 rtl_is_special_data(struct ieee80211_ } } else if (ETH_P_ARP == ether_type) { if (is_tx) { - rtl_lps_leave(hw); + schedule_work(&rtlpriv->works.lps_leave_work); ppsc->last_delaylps_stamp_jiffies = jiffies; } @@ -1024,7 +1025,7 @@ u8 rtl_is_special_data(struct ieee80211_ "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); if (is_tx) { - rtl_lps_leave(hw); + schedule_work(&rtlpriv->works.lps_leave_work); ppsc->last_delaylps_stamp_jiffies = jiffies; }