From patchwork Tue Aug 30 18:29:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Cardona X-Patchwork-Id: 1113672 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7UITWC4032654 for ; Tue, 30 Aug 2011 18:29:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755981Ab1H3S3X (ORCPT ); Tue, 30 Aug 2011 14:29:23 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:57533 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752258Ab1H3S3W (ORCPT ); Tue, 30 Aug 2011 14:29:22 -0400 Received: by iabu26 with SMTP id u26so1804709iab.19 for ; Tue, 30 Aug 2011 11:29:22 -0700 (PDT) Received: by 10.231.0.96 with SMTP id 32mr14013733iba.36.1314728961951; Tue, 30 Aug 2011 11:29:21 -0700 (PDT) Received: from localhost.localdomain (99-8-184-170.lightspeed.snfcca.sbcglobal.net [99.8.184.170]) by mx.google.com with ESMTPS id fr1sm1648068ibb.40.2011.08.30.11.29.20 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Aug 2011 11:29:21 -0700 (PDT) From: Javier Cardona To: "John W. Linville" Cc: Javier Cardona , Thomas Pedersen , devel@lists.open80211s.org, Johannes Berg , linux-wireless@vger.kernel.org, jlopex@gmail.com Subject: [PATCH] mac80211: Defer tranmission of mesh path errors Date: Tue, 30 Aug 2011 11:29:14 -0700 Message-Id: <1314728954-22646-1-git-send-email-javier@cozybit.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1314706867.4011.25.camel@jlt3.sipsolutions.net> References: <1314706867.4011.25.camel@jlt3.sipsolutions.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 30 Aug 2011 18:29:32 +0000 (UTC) Under failure conditions, the mesh stack sends PERR messages to the previous sender of the failed frame. This happens in the tx feedback path, in which the transmission queue lock may be taken. Avoid a deadlock by sending the path error via the pending queue. Signed-off-by: Javier Cardona Reviewed-by: Johannes Berg --- net/mac80211/mesh_hwmp.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index fd4f76a..f760679 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -209,6 +209,10 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, * @target_sn: SN of the broken destination * @target_rcode: reason code for this PERR * @ra: node this frame is addressed to + * + * Note: This function may be called from the tx feedback path, possibly with + * the transmission queue lock taken. To avoid a deadlock we don't transmit + * the frame directly but add it to the pending queue instead. */ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, __le16 target_rcode, const u8 *ra, @@ -263,7 +267,8 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, pos += 4; memcpy(pos, &target_rcode, 2); - ieee80211_tx_skb(sdata, skb); + /* see note in function header */ + ieee80211_add_pending_skb(local, skb); return 0; }