From patchwork Thu Jan 16 13:06:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pontus Fuchs X-Patchwork-Id: 3498431 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 352529F32F for ; Thu, 16 Jan 2014 13:07:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8FCE20158 for ; Thu, 16 Jan 2014 13:07:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A02A20142 for ; Thu, 16 Jan 2014 13:07:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619AbaAPNHE (ORCPT ); Thu, 16 Jan 2014 08:07:04 -0500 Received: from mail-la0-f50.google.com ([209.85.215.50]:48388 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752406AbaAPNHD (ORCPT ); Thu, 16 Jan 2014 08:07:03 -0500 Received: by mail-la0-f50.google.com with SMTP id ec20so2460818lab.37 for ; Thu, 16 Jan 2014 05:07:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=UMsO8DPBSAY/ry09Gs3zraLhwO3cBd4U4v2pGDSPBDw=; b=kBep5vT/8fMgzoG4zS6ZcU1GB7P/XVxKQXaCXUzUgAJ9n0eyW+hJ9Al+HgCrSbpgVE uxCh8ZeGfdKTWtR0CopeaiHz+rbgHPCZPmoS1y9hHSlNLCTv4BfDMQ+bDsV8Vcap3bvA bMQPSMxTnf8w8lwr5zCbVZgNlVoDnaNEJ97+q4tubrecnURAqGJCoBIJ1KcE66iVFLzK IefQS7czQ1rDQRrr/QFNZs9UZO9+B6JGBWQ90hz7dpvYG/S5bpwaow+0MMNs5FTuB1dw 9YjKpa/tf0mGqMpfxtZTU/GQBlpUEAd6xRiI3lgUxMQyt4QcFs7yQkzF/A1W5jKnz0od gQCg== X-Received: by 10.112.74.39 with SMTP id q7mr314460lbv.64.1389877620816; Thu, 16 Jan 2014 05:07:00 -0800 (PST) Received: from localhost.localdomain (host-90-238-9-100.mobileonline.telia.com. [90.238.9.100]) by mx.google.com with ESMTPSA id gi5sm1035325lbc.4.2014.01.16.05.06.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 05:06:59 -0800 (PST) From: Pontus Fuchs To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org Subject: [PATCH] nl80211: Don't touch split_start when split dump is not used Date: Thu, 16 Jan 2014 14:06:47 +0100 Message-Id: <1389877607-3162-1-git-send-email-pontus.fuchs@gmail.com> X-Mailer: git-send-email 1.8.3.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the netlink skb is exhausted split_start is left set. In the subsequent retry, with a larger buffer, the dump is continued from the failing point instead of from the beginning. This was causing my rt28xx based USB dongle to now show up when running "iw list" with an old iw version without split dump support. Signed-off-by: Pontus Fuchs --- net/wireless/nl80211.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d0afd82..32745e9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -1184,6 +1184,12 @@ struct nl80211_dump_wiphy_state { bool split; }; +static void split_start_inc(struct nl80211_dump_wiphy_state *state) +{ + if (state->split) + state->split_start++; +} + static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, struct sk_buff *msg, u32 portid, u32 seq, int flags, struct nl80211_dump_wiphy_state *state) @@ -1255,7 +1261,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, if ((dev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) && nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP)) goto nla_put_failure; - state->split_start++; + split_start_inc(state); if (state->split) break; case 1: @@ -1300,14 +1306,14 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, } } - state->split_start++; + split_start_inc(state); if (state->split) break; case 2: if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, dev->wiphy.interface_modes)) goto nla_put_failure; - state->split_start++; + split_start_inc(state); if (state->split) break; case 3: @@ -1385,7 +1391,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, /* if bands & channels are done, continue outside */ if (state->band_start == 0 && state->chan_start == 0) - state->split_start++; + split_start_inc(state); if (state->split) break; case 4: @@ -1479,7 +1485,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, } nla_nest_end(msg, nl_cmds); - state->split_start++; + split_start_inc(state); if (state->split) break; case 5: @@ -1496,18 +1502,18 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, if (nl80211_send_mgmt_stypes(msg, mgmt_stypes)) goto nla_put_failure; - state->split_start++; + split_start_inc(state); if (state->split) break; case 6: #ifdef CONFIG_PM if (nl80211_send_wowlan(msg, dev, state->split)) goto nla_put_failure; - state->split_start++; + split_start_inc(state); if (state->split) break; #else - state->split_start++; + split_start_inc(state); #endif case 7: if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES, @@ -1518,7 +1524,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, state->split)) goto nla_put_failure; - state->split_start++; + split_start_inc(state); if (state->split) break; case 8: @@ -1560,7 +1566,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, * case we'll continue with more data in the next round, * but break unconditionally so unsplit data stops here. */ - state->split_start++; + split_start_inc(state); break; case 9: if (dev->wiphy.extended_capabilities && @@ -1578,7 +1584,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, dev->wiphy.vht_capa_mod_mask)) goto nla_put_failure; - state->split_start++; + split_start_inc(state); break; case 10: if (nl80211_send_coalesce(msg, dev)) @@ -1588,7 +1594,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) || nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ))) goto nla_put_failure; - state->split_start++; + split_start_inc(state); break; case 11: if (dev->wiphy.n_vendor_commands) {