Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6802858rwi; Mon, 24 Oct 2022 06:21:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xX/CXezm2yw37i6phbIO1wsBEWrWkKtJ3wltNzi6srtRY3kbVWALgq/GsbToFo2NAT93O X-Received: by 2002:a17:906:30c5:b0:782:707:9e2d with SMTP id b5-20020a17090630c500b0078207079e2dmr26867572ejb.286.1666617694534; Mon, 24 Oct 2022 06:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617694; cv=none; d=google.com; s=arc-20160816; b=Rom1N8sip5QZqKFf4YLfrFGZXVWgOSDpBhG7N3bChgOezwSQGXNh5VXC8q/d/S1RAU SXXPWEjCTJ6NHNVkgaXca7sxBJiiJ7vcYYsdkCAossZcSi8iGKWF7b6Z/MsT3gr/kTI3 2PRM9l7+bGyfDtYMHuhyemalAJid7+Kp0FWjm1+glykWTz6aukBb/dfcMG9fbT1OiTA1 /5WqGiENKJhHQeFqkbnaNkDtzFO5ie90s6zAMEoE4QAjx4Q0kVIG8FAe9cAhIhup7dMd No9VywlKMxYhlwAN5bjJFlCupRAp5pqBzdovXDVaICGXyr2RlL/jdfhIaslZYoJyXTRB 9Rcw== 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=TkKvEh61/pGzvRpV5ZUDnfzcBQySgRo8HsH9woqZjgs=; b=ea/0OdlCFa6p7CXbGaXhXlU/msjpPAVYoD8JffSFYiMFHjv8f+wVACOrmh44+teXJ1 ySZggYlq4/MgeQ2TkTb5sHwmq0g6hKFphk2sKVGzHsXayxVifgZ2/RcBEzAih56lMCy+ Mn28zqqJZijh4jLNx9wN3JPoJNazRDbOKC5W1kWEqBgw6lbH6SpnB5FOuEV1UHclxwhB ueuwW5BdFj3Ii2xZJbxo5FPdORHNNWKSPoG713Zxx84Lg9T981DMVF9j22DMAbtTeN4R Spueae4+FTdp8lL11PSwtVTSelolyBIV6Km7bSy1vqQEYOHY3MXiKgT6vuSqGBAkHs/m Z19A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqvbvSez; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eh1-20020a0564020f8100b00461f285ce57si635490edb.211.2022.10.24.06.21.06; Mon, 24 Oct 2022 06:21:34 -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=ZqvbvSez; 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 S232416AbiJXL6q (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbiJXL5t (ORCPT ); Mon, 24 Oct 2022 07:57:49 -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 4637A7B58E; Mon, 24 Oct 2022 04:47:19 -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 5297A6125A; Mon, 24 Oct 2022 11:47:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65D50C433D6; Mon, 24 Oct 2022 11:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612035; bh=JZ/6C+T35YGb6+Ln7URFq8PZ9sBiH9mzyYJMG3EFmKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqvbvSezVFx7yjTyvPTckSVxcBOQFl8CZJwIZEBW93oJbGwT2wdAKAZdIjudl7hXs S2T8Rv0mULqBL+3Gfp03kp6KzQzQqdXf+ycVRinp+SNWPLYdfuogk3fx/tcrMGnIba tmUzTKCL6kf0JzcHmSaD9FbPMymAKJ3XQGn/0yBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?S=C3=B6nke=20Huster?= , Johannes Berg Subject: [PATCH 4.14 046/210] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Mon, 24 Oct 2022 13:29:23 +0200 Message-Id: <20221024112958.486347073@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 @@ -3075,6 +3075,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));