Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3922580pxb; Mon, 4 Oct 2021 12:43:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3Lm16bG+sTykGASPQk7VbUYUyqxNXi/ENUJrW1o4sHPHfAOTFMV1dmool/N0JYiTQbNRo X-Received: by 2002:a50:c31a:: with SMTP id a26mr17316215edb.193.1633376616184; Mon, 04 Oct 2021 12:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633376616; cv=none; d=google.com; s=arc-20160816; b=fPpbX0zHmkWmv4C7JXpg2WGBfceP1MZ/asAA35hKyGB37lA+5W7R3MEIegDnVb/jyX 2B9BRpkdveKWR6jUoczu4M2u+qACnZuMLM1+e37G7t+F33giebsogn8Q1SPZs2tnRNrc zYBbBPMLKBTWqFC7xxNzoSMf6VrQzjPjtzHzX2Za1NMjLoCkiMrNkajY9sgNU/CKPk70 vX2ru8DSvlj10XT0Bo92xBLCls0u/8R7PnUiU50J7DPFwrE8SX2Vcei2ih59gbZpubtq YoqF0g7oVBUVoB0L2UuaQbEIWwO71QBaUIPArppggXpjX5+ERIM1phh+bV1r4BlFxq3F bkeQ== 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=yrkYuX9+qn3xQ2Dqe3+ALwYY0AGrXqTihW3wooflflA=; b=tc+CZ50iZRL2TO7r7u4J59tMslmLgfqWIQcZZpDHfmEVkdPwQBqujYom5VY32EGclI 9K4Ub3VLj8evjgll6RSX9v+ZTJYKBeMdxtz9ZjcyIbospxCgjBMMVE1zVqVSlgXXxWCk wC28dNURDA1f8XffnlcCqCoyhZspta9aqePq6Arn7F/lUwa5Wc4pmyXaKLVjWz+4nyFn tqMh3uwmZMSNVC77sqD0S878jmnDL/oZQwpr0l6+f+iwcDsydqvC4Q7JIkb8cDMhVsI0 N/EEiJ4Ne8rtLmmZYyipL82SbTXk9+dcFnNMhrx4pVm0dwVPCxgiCzCnGILnQ4rilmGl Ho3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvd9VrOJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si23654328ede.102.2021.10.04.12.43.10; Mon, 04 Oct 2021 12:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvd9VrOJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S235070AbhJDNFh (ORCPT + 99 others); Mon, 4 Oct 2021 09:05:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:39448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235062AbhJDNDm (ORCPT ); Mon, 4 Oct 2021 09:03:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8EB5061AF9; Mon, 4 Oct 2021 13:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633352402; bh=IswSeUesp3hlXcqAOgWQVnb4v4CMeDU1DOJNydfvpPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vvd9VrOJT8CKvHmca6iUrUv2EZQ5cpZe//XeD4YLL9yK9LVP60FDsWORVILxOhS8H 3wBshOMc4ZacRtY7TzPnsgAROiRjaiuVzG2ed0s2roFdZImGcrK/LgwPFAe7qa96Vo LFDwcA5wNeor1FBVSk8bcMn062x1e9ZF8u1rbJWw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+0196ac871673f0c20f68@syzkaller.appspotmail.com, Lorenzo Bianconi , Johannes Berg , Sasha Levin Subject: [PATCH 4.14 48/75] mac80211: limit injected vht mcs/nss in ieee80211_parse_tx_radiotap Date: Mon, 4 Oct 2021 14:52:23 +0200 Message-Id: <20211004125033.142784843@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125031.530773667@linuxfoundation.org> References: <20211004125031.530773667@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit 13cb6d826e0ac0d144b0d48191ff1a111d32f0c6 ] Limit max values for vht mcs and nss in ieee80211_parse_tx_radiotap routine in order to fix the following warning reported by syzbot: WARNING: CPU: 0 PID: 10717 at include/net/mac80211.h:989 ieee80211_rate_set_vht include/net/mac80211.h:989 [inline] WARNING: CPU: 0 PID: 10717 at include/net/mac80211.h:989 ieee80211_parse_tx_radiotap+0x101e/0x12d0 net/mac80211/tx.c:2244 Modules linked in: CPU: 0 PID: 10717 Comm: syz-executor.5 Not tainted 5.14.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:ieee80211_rate_set_vht include/net/mac80211.h:989 [inline] RIP: 0010:ieee80211_parse_tx_radiotap+0x101e/0x12d0 net/mac80211/tx.c:2244 RSP: 0018:ffffc9000186f3e8 EFLAGS: 00010216 RAX: 0000000000000618 RBX: ffff88804ef76500 RCX: ffffc900143a5000 RDX: 0000000000040000 RSI: ffffffff888f478e RDI: 0000000000000003 RBP: 00000000ffffffff R08: 0000000000000000 R09: 0000000000000100 R10: ffffffff888f46f9 R11: 0000000000000000 R12: 00000000fffffff8 R13: ffff88804ef7653c R14: 0000000000000001 R15: 0000000000000004 FS: 00007fbf5718f700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2de23000 CR3: 000000006a671000 CR4: 00000000001506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Call Trace: ieee80211_monitor_select_queue+0xa6/0x250 net/mac80211/iface.c:740 netdev_core_pick_tx+0x169/0x2e0 net/core/dev.c:4089 __dev_queue_xmit+0x6f9/0x3710 net/core/dev.c:4165 __bpf_tx_skb net/core/filter.c:2114 [inline] __bpf_redirect_no_mac net/core/filter.c:2139 [inline] __bpf_redirect+0x5ba/0xd20 net/core/filter.c:2162 ____bpf_clone_redirect net/core/filter.c:2429 [inline] bpf_clone_redirect+0x2ae/0x420 net/core/filter.c:2401 bpf_prog_eeb6f53a69e5c6a2+0x59/0x234 bpf_dispatcher_nop_func include/linux/bpf.h:717 [inline] __bpf_prog_run include/linux/filter.h:624 [inline] bpf_prog_run include/linux/filter.h:631 [inline] bpf_test_run+0x381/0xa30 net/bpf/test_run.c:119 bpf_prog_test_run_skb+0xb84/0x1ee0 net/bpf/test_run.c:663 bpf_prog_test_run kernel/bpf/syscall.c:3307 [inline] __sys_bpf+0x2137/0x5df0 kernel/bpf/syscall.c:4605 __do_sys_bpf kernel/bpf/syscall.c:4691 [inline] __se_sys_bpf kernel/bpf/syscall.c:4689 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4689 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665f9 Reported-by: syzbot+0196ac871673f0c20f68@syzkaller.appspotmail.com Fixes: 646e76bb5daf4 ("mac80211: parse VHT info in injected frames") Signed-off-by: Lorenzo Bianconi Link: https://lore.kernel.org/r/c26c3f02dcb38ab63b2f2534cb463d95ee81bb13.1632141760.git.lorenzo@kernel.org Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 0b5171824338..7e62a55a03de 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2068,7 +2068,11 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local, } vht_mcs = iterator.this_arg[4] >> 4; + if (vht_mcs > 11) + vht_mcs = 0; vht_nss = iterator.this_arg[4] & 0xF; + if (!vht_nss || vht_nss > 8) + vht_nss = 1; break; /* -- 2.33.0