Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1697694ybe; Sat, 7 Sep 2019 00:50:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRza17owr0vo02oapQwkFloftG/n7RNKuL9mMtypDanBMSDNGfrbtAoqugQftzNfgvHfn+ X-Received: by 2002:a17:90a:7f06:: with SMTP id k6mr14260098pjl.87.1567842638216; Sat, 07 Sep 2019 00:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567842638; cv=none; d=google.com; s=arc-20160816; b=qma4Pj7cDiI89Pl+9WOJi77FK0kEVU49SB1H0HcNPqHGboAB59cR5KuixQVvjOVYaS xKV2mTMsnWOYDl321OeVtPC6mO1GgZWdaRRYnafJRncBiJ8C5sk0sNXHOIw5M0ZLRPfh hmznLP02sQVOdGhnTxYP1DS6KHH0I+43SbxT/AagEnXSFqJ2p3C5+YKhO9wVkoT1GdXY V7obqEGAWALvfvPfi18QrRPSQvRDSXC2GlXshRFig6A4MPddPkE1vPj9+zvaAY93OtGw 1FwsrchVBoD0MYViR6relk+bZCtl8WL1OmMbNh6hXZxIaSv5Q/glamSSRuin8f4s0oeu nYIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pZuCK/LFe/OO1BZ3AqGk4ZltIe3DN6IjRd0ZQCCV4HE=; b=g1vwhpUIly+59YFRbftwnEfZu+Hm+r3aWYz8twc8mA1j4B0dZDIC7NurJHs5fAB2d+ Y1GYru7BE7ppveAEMoMs27U+Mvr7C16OXNhaHy/vqtSoBAudh2j6H71uYca1/3QySeHB LrUQ1H+AvEmeKSmv3nNl6Dhme+6pqFuITjK7quzWFGgQekxYNQRj36RczlA8o1ewg1Mj SGxJY7Q9sLRHzh6QY37A+jB8GKLHX+mQZCJpdPC6Nfyta3MGRCwU0E2Ir2KNdf6SdfHs VLv665ZuLI1iSzIel8EOIJ/eRR/bQQXNov2vHulFD3HZkzLuo/8awcAksikDgh00riZm C+kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VVgPsTw7; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si5210022pjs.94.2019.09.07.00.50.04; Sat, 07 Sep 2019 00:50:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VVgPsTw7; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394933AbfIFPtM (ORCPT + 99 others); Fri, 6 Sep 2019 11:49:12 -0400 Received: from mail-ot1-f51.google.com ([209.85.210.51]:44595 "EHLO mail-ot1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732456AbfIFPtL (ORCPT ); Fri, 6 Sep 2019 11:49:11 -0400 Received: by mail-ot1-f51.google.com with SMTP id 21so6115721otj.11 for ; Fri, 06 Sep 2019 08:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pZuCK/LFe/OO1BZ3AqGk4ZltIe3DN6IjRd0ZQCCV4HE=; b=VVgPsTw7tdR8ZTTxfHyTqhFef1mVV/I+n6vowXOUKKJN8lJUsgbGMSgbldvWhGYWk1 DIrDL8CVethiTZYXaopRzhzScy23FFeGyRVdDfyRzvXZBFjLSkd47+GSkFwCvFl8/xc/ c/pTWJ86IeFs60nydcHzF4cteKJ6R54O93GSMEsxJxo4wiLJ3SlWRoDPtO1r9Rb3hM73 7uQkkBUaw2WrFnlTNbr7Vi3jw+PugZOQVZvQkXQMTLCzsgdkePPhYAQkt1FT07tLs8s7 S8JclLtsRGAVsTkWfDk5gcbBz4VvtNeJ9CHgT/KulDyQvWy0Iy1ta5rMKqCYEDQyh7RD PLGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pZuCK/LFe/OO1BZ3AqGk4ZltIe3DN6IjRd0ZQCCV4HE=; b=rM/J9mjyESz9GI6jpWYXYS9MbuYOE0FcHSs2rz/eXnVrTceleLtiXu2Cq12/H8eDde 4UBDsDxm9EaNXjaDfnPrLV4DU0zENImYlC5VpyJzTZi534sZzc6g49EIj1QmhXhHUMf5 P1wqMMQN00p1jhDuzSdN1pytZZjiftEoXK/yq4X1IbawTbp6NIkFX7VMONIYxhQpFiQG mPdw4DWIhtqy/M70utxe/IQNfw8Qj81NxS6HsN4or+gqH4upa2hlhTbVGheXzwN1MThe 04TLan6f/oblEHPlJjz0xKyhglQIe8PUy+4poVbo2sBXhNGlSOZRDrJdUSvfUNCohZvO E7YQ== X-Gm-Message-State: APjAAAV1myT+A0qzSu/6+pQOo/prk7uVErzTbmMo2+mex7reukKvuwIr 79qCX7PBnP9rywL+G+ngHLlpeRKk X-Received: by 2002:a9d:6356:: with SMTP id y22mr7608951otk.20.1567784950355; Fri, 06 Sep 2019 08:49:10 -0700 (PDT) Received: from localhost.localdomain (cpe-70-114-247-242.austin.res.rr.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id j7sm2105587otn.65.2019.09.06.08.49.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Sep 2019 08:49:05 -0700 (PDT) From: Denis Kenzior To: linux-wireless@vger.kernel.org, johannes@sipsolutions.net Cc: Denis Kenzior Subject: [RFCv3 1/3] nl80211: Fix broken non-split wiphy dumps Date: Fri, 6 Sep 2019 10:43:01 -0500 Message-Id: <20190906154303.9303-1-denkenz@gmail.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If a (legacy) client requested a wiphy dump but did not provide the NL80211_ATTR_SPLIT_WIPHY_DUMP attribute, the dump was supposed to be composed of purely non-split NEW_WIPHY messages, with 1 wiphy per message. At least this was the intent after commit: 3713b4e364ef ("nl80211: allow splitting wiphy information in dumps") However, in reality the non-split dumps were broken very shortly after. Perhaps around commit: fe1abafd942f ("nl80211: re-add channel width and extended capa advertising") The reason for the bug is a missing setting of split_start to 0 in the case of a non-split dump. Here is a sample non-split dump performed on kernel 4.19, some parts were cut for brevity: < Request: Get Wiphy (0x01) len 0 [ack,0x300] > Result: New Wiphy (0x03) len 3496 [multi] Wiphy: 0 (0x00000000) Wiphy Name: phy0 Generation: 1 (0x00000001) > Result: New Wiphy (0x03) len 68 [multi] Wiphy: 0 (0x00000000) Wiphy Name: phy0 Generation: 1 (0x00000001) Extended Capabilities: len 8 Capability: bit 2: Extended channel switching Capability: bit 62: Opmode Notification Extended Capabilities Mask: len 8 04 00 00 00 00 00 00 40 .......@ VHT Capability Mask: len 12 f0 1f 80 33 ff ff 00 00 ff ff 00 00 ...3........ > Result: New Wiphy (0x03) len 28 [multi] Wiphy: 0 (0x00000000) Wiphy Name: phy0 Generation: 1 (0x00000001) > Result: New Wiphy (0x03) len 28 [multi] Wiphy: 0 (0x00000000) Wiphy Name: phy0 Generation: 1 (0x00000001) > Result: New Wiphy (0x03) len 52 [multi] Wiphy: 0 (0x00000000) Wiphy Name: phy0 Generation: 1 (0x00000001) Max CSA Counters: len 1 02 . Scheduled Scan Maximum Requests: len 4 01 00 00 00 .... Extended Features: len 4 02 02 00 04 .... > Result: New Wiphy (0x03) len 36 [multi] Wiphy: 0 (0x00000000) Wiphy Name: phy0 Generation: 1 (0x00000001) Reserved: len 4 00 00 00 00 .... > Complete: Get Wiphy (0x01) len 4 [multi] Status: 0 Signed-off-by: Denis Kenzior --- net/wireless/nl80211.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3e30e18d1d89..ff6200fcd492 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2191,6 +2191,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, * but break unconditionally so unsplit data stops here. */ state->split_start++; + + if (!state->split) + state->split_start = 0; break; case 9: if (rdev->wiphy.extended_capabilities && -- 2.19.2