Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1356061rwi; Thu, 13 Oct 2022 12:29:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7unIKYdJEIffXPqZtBNuPQWRYgjLtZaTxDSIzZuu+7lIsfWLe+9Z2BMD8F0ClpRY8v6gP3 X-Received: by 2002:a63:6cc6:0:b0:457:5f5f:9dff with SMTP id h189-20020a636cc6000000b004575f5f9dffmr1212670pgc.493.1665689344185; Thu, 13 Oct 2022 12:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665689344; cv=none; d=google.com; s=arc-20160816; b=DkpNYJIu2g7Rat9427bCN5SMJ6nN+n7zBOyexQiz07i4PEKdAKF06diWLj/ctySNIM 6kZP+PCay79EqELv3inzz3wPZ9l6H3xoc1gSi56olWCpJPPF8GPZtSCWlb6owxDoa79V ZpF/ads76ZFTrpiM6cDUt1Ak0EnXhYqPiCmGlTYvW4FwC+3PihBK/j0pQKq8grJUE6pH Fgi6XDCM9Gh+ZNmuzEkbKhydUF/eENZ5Q/iqAcySFTwvi083Grw4sx7oZ5Gywzo+39zN VRtLgLvqat3vUWqkY1chqwcunpXKud88MlqUE83vkR0tADb8SQoZZkE99mIIJQjjgPy5 kfjQ== 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=HzMJJalQwb7HxWA603kQeO1cH4xqQ74/CblSq3eq7Ns=; b=LQJOHHWQQR6mOC9/vw7z2BJgSOkJrscSRGbbdSEx6R4KD3kU5lrGdymVEp0ygUJ/mB iPn+FOhGE/4hCDAbgeelVh6iq8hQKlrNSsjbTnl7fMF3AFri3UaJKnUalaALnrzcsC97 lLZf3xBSMYAcIRxuay6JIXYrwFyeycZnlhH3WnrTHdp2Ki5cKI3xYoNN4Tk/fFobGG8I Pw3k3b5aFj5ZR4OjOb1uUDVnspAkObzwjbtKiMyyMzTtGr6sjakAOZeEl0khnbYZGS+R dQW6gTCMA2Hjhb/KCtRAwZFo24H58tNCU4DDA64c4cz3eLPCgRPJfRLKJrokU1fV8R3m /M6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vyf1yqgZ; 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 a70-20020a639049000000b004611cfaca6asi236596pge.381.2022.10.13.12.28.52; Thu, 13 Oct 2022 12:29:04 -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=Vyf1yqgZ; 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 S229740AbiJMTMm (ORCPT + 99 others); Thu, 13 Oct 2022 15:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229972AbiJMTMZ (ORCPT ); Thu, 13 Oct 2022 15:12:25 -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 ED5D23A4AA; Thu, 13 Oct 2022 12:12:24 -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 29D3C61938; Thu, 13 Oct 2022 17:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C16CC433D7; Thu, 13 Oct 2022 17:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683880; bh=iSU4oNQTGikY1NG5fAAZBCNpZVckUY3c/pPdJ+jMIKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vyf1yqgZ+LTTc0hge2FYKEgVTJVDWaXcukYQvs01TEkxnlk6iCyAg6m9HpeVP1JYc Ma5MH01/L13d62XJVom4TR9kvRnqod3XWjp7xAE8AMIbO1rO0b944CU8a4oU8l8HE4 0/+KyUL0bz/mv9SoaUmoQ6rJK7q5uRijbwfXBWwc= 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 5.15 21/27] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Thu, 13 Oct 2022 19:52:50 +0200 Message-Id: <20221013175144.324918092@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175143.518476113@linuxfoundation.org> References: <20221013175143.518476113@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.1 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 @@ -3749,6 +3749,8 @@ static int hwsim_cloned_frame_received_n rx_status.band = 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]); hdr = (void *)skb->data;