From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 B6FCEC2D0F3 for ; Wed, 1 Apr 2020 16:25:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B4C2212CC for ; Wed, 1 Apr 2020 16:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585758337; bh=BhT/D1kTWmqjXwICqOMiOAekpfWqzXWKo9gjIXo9JDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eyHF66CzdH3VhYIdZ6it2uIvFVqSZleLIxS+qmXdbOVFWmx+9GI6v7Aj1+AM1Ng9g zw4CFpHDG4gbfdBcqEaa52ujfwr3hr2HU7hzJhdBcN0xO8EnZRrcIQenaFk5hz11wa ACDtAuDvGKJLJntq0RTkEsgN1R+c4+xk/R9jRO5U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387621AbgDAQZg (ORCPT ); Wed, 1 Apr 2020 12:25:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:49792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732376AbgDAQZg (ORCPT ); Wed, 1 Apr 2020 12:25:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 4B8F6215A4; Wed, 1 Apr 2020 16:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585758334; bh=BhT/D1kTWmqjXwICqOMiOAekpfWqzXWKo9gjIXo9JDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8MAGUi9RBA8cq1FEXhJv8/4nJIvb6zRFvcIi26HRk+YgxujZjoRHNsbmPo86Btyo yBCsqn5Zb1n2aP1AdWjs3gDHcFAXNs9Y6gKqWHZyu8s+MwvcAtyLqb015ZP23q8f4J jHfUhRODjwuFhPNCMpHx38nOaBo/ZSdXgZPn64XU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg Subject: [PATCH 4.19 058/116] nl80211: fix NL80211_ATTR_CHANNEL_WIDTH attribute type Date: Wed, 1 Apr 2020 18:17:14 +0200 Message-Id: <20200401161550.062191550@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401161542.669484650@linuxfoundation.org> References: <20200401161542.669484650@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johannes Berg commit 0016d3201753b59f3ae84b868fe66c86ad256f19 upstream. The new opmode notification used this attribute with a u8, when it's documented as a u32 and indeed used in userspace as such, it just happens to work on little-endian systems since userspace isn't doing any strict size validation, and the u8 goes into the lower byte. Fix this. Cc: stable@vger.kernel.org Fixes: 466b9936bf93 ("cfg80211: Add support to notify station's opmode change to userspace") Signed-off-by: Johannes Berg Link: https://lore.kernel.org/r/20200325090531.be124f0a11c7.Iedbf4e197a85471ebd729b186d5365c0343bf7a8@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -15607,7 +15607,7 @@ void cfg80211_sta_opmode_change_notify(s goto nla_put_failure; if ((sta_opmode->changed & STA_OPMODE_MAX_BW_CHANGED) && - nla_put_u8(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw)) + nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw)) goto nla_put_failure; if ((sta_opmode->changed & STA_OPMODE_N_SS_CHANGED) &&