From patchwork Mon Oct 24 11:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417485wru; Mon, 24 Oct 2022 05:13:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PIemLnPvrdV2M/pxvUV4S7RJRASYID+bUtjcUsiRB6LM/uiZsjogIHpDpyvp/YiiMdTx6 X-Received: by 2002:a17:907:7638:b0:7aa:987f:4e91 with SMTP id jy24-20020a170907763800b007aa987f4e91mr1222029ejc.442.1666613591621; Mon, 24 Oct 2022 05:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613591; cv=none; d=google.com; s=arc-20160816; b=cpCeUnNxlhr+p7fnfm3raw/SFg4Hdh4VGUFReX6L8Pex/4rQEdQd/l8CSMUDguMdYg /4gtOhTkuRrqjyRTlAMRFeBMaCSLI8EQ57KML+SSFik0Ayb5debJ81/0C4tBOA5F91fl YBGJBSLxgzMtv0c8Rq4Uc4Yf96141ZzW01+cD4ZaJ4e4YIf1YdkJ7BnvPhpaIBbkywV1 TWNQHSZFbULZPi2nOm8wFxxHsYZ7CHIAs11uJCUy8me5ZHo9YIfOBr/x5MU5JKZumpAO 0/RNFXWU3s939esa3zdFZK+Wgju2wQAldlLB1HntzEAOltcQrGki8pyWMVil1d+0GVrR ZJWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6d13aiVj2Jmyy3rUatHe9ZeawUttXIdC56xIkiysHGE=; b=CDokP1Q++6105nrvRSqzNLjbe4Ju3kR4VXNTBrGPf8zUcmaFW0wkvE8lcmP0K4gzFS dBD55xOyrZfJvPyIXyofG5R9iAoHUHGv4o0m74JG0ljJg0zs63XKztOIEMf6J/b7hlMM g9JfDgU3VZcpyMHFtvYSG/D9m2dMYuvtnCPqa6cViFYAdzsziLNgjbRW2WFBib93rU6R NqK0qVOCqe+Q7J09FmKv97lDHc933hRK5GkdR8JLA400Ypoq9QsWvtLW0ir0x3v5QcDn hTyfzusgDMdPjZNboAEKqix363nWaSnfdjmYoUxkIgmNpSuysr2sOnT32a/u57mdRRg3 jTLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MmlZMV0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg20-20020a170907a41400b0078db6f5f4b2si27932257ejc.546.2022.10.24.05.12.44; Mon, 24 Oct 2022 05:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MmlZMV0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232438AbiJXMAr (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbiJXL6w (ORCPT ); Mon, 24 Oct 2022 07:58:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2C87C1EA; Mon, 24 Oct 2022 04:47:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22EDE61295; Mon, 24 Oct 2022 11:39:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37333C43470; Mon, 24 Oct 2022 11:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611591; bh=Ap5ywalXWtWaRZsxV1rvpRcRkw5qRaysAZ8ipIM0BpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmlZMV0KI7fYsqzs9WjRlo6jMeY2ihX2KTlmHE2IE8sbAVa/jfJkv7Hvzju701Fjl of+J0KaE0F8+Kpav9kozSKiE089e7tvi8N9+wYxrqWyPZBWokHtZlSVAsgaPcz/p/1 kM+Q0Rf+kTVeIqfjiL/ceh4AjN3KJ8dPG7BxkXgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?S=C3=B6nke_Huster?= , Johannes Berg Subject: [PATCH 4.9 036/159] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024112950.709946230@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571013503979543?= X-GMAIL-MSGID: =?utf-8?q?1747571013503979543?= From: Johannes Berg commit 1833b6f46d7e2830251a063935ab464256defe22 upstream. If the tool on the other side (e.g. wmediumd) gets confused about the rate, we hit a warning in mac80211. Silence that by effectively duplicating the check here and dropping the frame silently (in mac80211 it's dropped with the warning). Reported-by: Sönke Huster Tested-by: Sönke Huster Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3011,6 +3011,8 @@ static int hwsim_cloned_frame_received_n rx_status.band = data2->channel->band; rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); + if (rx_status.rate_idx >= data2->hw->wiphy->bands[rx_status.band]->n_bitrates) + goto out; rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));