From patchwork Tue Oct 18 17:43:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1691651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=nb9DSJSA; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MsLpT6QjNz23jx for ; Wed, 19 Oct 2022 04:44:33 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1okqdd-0003x8-D5; Tue, 18 Oct 2022 17:44:25 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1okqda-0003qw-Lt for kernel-team@lists.ubuntu.com; Tue, 18 Oct 2022 17:44:22 +0000 Received: from localhost.localdomain (1.general.cascardo.us.vpn [10.172.70.58]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 59A253F4C1 for ; Tue, 18 Oct 2022 17:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1666115061; bh=SU+v1vFiewGTmuqEJE9e/bSZpqpXfRtA+SxZEgVWNQs=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=nb9DSJSA72Wp+kHBRz6/7Q/W//PrIU/Q3WSHRDnNpHipqOOJL6qR0fdK0VBQlfZO1 dSu/rs+0rt/fiB/rkrH0GkYMNlEzHfBXxC4IDGw+Z95SHdO0pv7VqHZx2flyEfjDBg +yd8d4JJKp4b3ej7SanMqOGUipj/WcZZXVkRoXffgkH6Oa9YJ6pohgxU7oQUlfMgmh UuXEcODmK9hSMzR3OPsBUZa/vJQEA1AMmI/L/CDtIN9Zu9a3r2qb0rEGT5ig5YPjSF 3XnScXL8w/DS/8mXP3grBIT5gEEUnNw6MBZ6bLAPzsEYt4Ddxzaid+cQUQkv8B2Y13 Qmgc6iIHjrO7w== From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU OEM-6.0 7/9] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Tue, 18 Oct 2022 14:43:10 -0300 Message-Id: <20221018174312.3383944-8-cascardo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221018174312.3383944-1-cascardo@canonical.com> References: <20221018174312.3383944-1-cascardo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Johannes Berg 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 (cherry picked from commit 1833b6f46d7e2830251a063935ab464256defe22) CVE-2022-41674 Signed-off-by: Thadeu Lima de Souza Cascardo --- drivers/net/wireless/mac80211_hwsim.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 1f301a5fb396..ee34814bd12b 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -4526,6 +4526,8 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, 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;