From patchwork Tue Oct 27 13:52:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 306999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52CF4C4363A for ; Tue, 27 Oct 2020 17:53:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07FA92076D for ; Tue, 27 Oct 2020 17:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603821224; bh=P3eiigDrjbceMQa001iT9bQphKWP3yqQUrbj5CvO1xI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=G6ba3heZ88XXiC1EKSw9ubTRs82tgfy/pdzR6yHuPaI0+ujn0n4/zf/XCUd6WQVOV OOf6+i2jFVVFvcrrqzZhHw9r/uFPJMWTGsaVb703epfvg5cmFDuIfVS3OrKwD7/Nz5 qeW2ChEhkZgkvSM9m4wvSP0TePCam9N7oECgF6EM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758693AbgJ0OXL (ORCPT ); Tue, 27 Oct 2020 10:23:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:47970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757412AbgJ0OXK (ORCPT ); Tue, 27 Oct 2020 10:23:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 677762072D; Tue, 27 Oct 2020 14:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808590; bh=P3eiigDrjbceMQa001iT9bQphKWP3yqQUrbj5CvO1xI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9BPWN2TeZe0EUzUqbL8V/qOw5oXX0aDlvRVSfG++1rFOiOhOzW5HgAbv5+rtrUVd cwjdAJ9Lwj8IjbwssFsOuIzv8mGP6Okt6+FhF/QilK1OW4dw4MBSpanDGGS9lvos76 dAP8/VLjMw9L1+V2FGEdnfDTu6BiUypK1PiPPuSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 4.19 118/264] nl80211: fix non-split wiphy information Date: Tue, 27 Oct 2020 14:52:56 +0100 Message-Id: <20201027135436.233847377@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135430.632029009@linuxfoundation.org> References: <20201027135430.632029009@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johannes Berg [ Upstream commit ab10c22bc3b2024f0c9eafa463899a071eac8d97 ] When dumping wiphy information, we try to split the data into many submessages, but for old userspace we still support the old mode where this doesn't happen. However, in this case we were not resetting our state correctly and dumping multiple messages for each wiphy, which would have broken such older userspace. This was broken pretty much immediately afterwards because it only worked in the original commit where non-split dumps didn't have any more data than split dumps... Fixes: fe1abafd942f ("nl80211: re-add channel width and extended capa advertising") Signed-off-by: Johannes Berg Link: https://lore.kernel.org/r/20200928130717.3e6d9c6bada2.Ie0f151a8d0d00a8e1e18f6a8c9244dd02496af67@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/nl80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4e41792099822..fbc8875502c3e 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -1950,7 +1950,10 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, * case we'll continue with more data in the next round, * but break unconditionally so unsplit data stops here. */ - state->split_start++; + if (state->split) + state->split_start++; + else + state->split_start = 0; break; case 9: if (rdev->wiphy.extended_capabilities &&