Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4718698pxb; Thu, 14 Oct 2021 10:32:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/+Nf22Bl5v59PuZDG7L4FnvlSWM6EGynWRVI8SeuT5Tsw+DH8MEnHkGkM5DCyzw0//gon X-Received: by 2002:a17:90a:708c:: with SMTP id g12mr21640535pjk.13.1634232774276; Thu, 14 Oct 2021 10:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634232774; cv=none; d=google.com; s=arc-20160816; b=0JXda+SsMDcF76VvwIcFo5rdVhWXNlaB+/qKRJTCxhRcfosKM30eNW3+EPlhdNdr00 QgKdndKDkmd15ZIBkwx0kDDknTt+dYJmToj6JhtYpngZzOLCxhiarFEIVUdKHlk7Dv+k zuPsJVSKozAFVRoqBZeCpcrzdD7Rm9LI8/3Rborcb19BpHDbkTE4xe5vHPFi5IzWS4zb JYioHdgucuoO1J38qZ9Vkhs33q67t4mA5IYGvyBTg3DH5dmoVSS/zVt67qXWO1TZBn3P nZtM6nDXtV6Fnc1gzxLmalfvbHgVtSFvI2CU8QEe86w+OsKFU0ggwWzT2rwkR5Ro8foF 1HIg== 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=1doQUSvboxowB/v0RgmYt/c4jtETaKWt+MGpNNZVdok=; b=Eo5qYc/kE0Gz+FDkUA0dwfOCAbzjNeehe3rXM61mu0mUtvOmWSsrP9Qv84ngI4xOkc /u5jQxB24IhmdeQI7kYsF0iTqaK/VaEgrP7ejdbazWM2WXxac+qJB127HlCmgFP3hpWR T3djq5fUqzTxQ396n9fI4h1S6iLWVRxDFShc0kD3aWnv1fvWD1YU46c2msFyngErDLp7 7vK4FK24kELylRieSBG3jW8lLmugzBqBvX0VAiifXD9hsOOLLLg85LXhVrwVCFKmFQUU 6Qs+/VB2OWFLYpqp2SO1S7Q14Hc/lCVYHU8uh6eRNWtf34XczyZNaZCAClAWpVSuDZsV 8yaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eBI/VdyZ"; 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 d18si4353133plr.345.2021.10.14.10.32.41; Thu, 14 Oct 2021 10:32:54 -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="eBI/VdyZ"; 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 S233029AbhJNPC2 (ORCPT + 99 others); Thu, 14 Oct 2021 11:02:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:43406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbhJNPA5 (ORCPT ); Thu, 14 Oct 2021 11:00:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A786611F0; Thu, 14 Oct 2021 14:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634223509; bh=1mVA/dIFluUI+oN8vg557h1bTtlAe17ZpEeU2IQfOSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eBI/VdyZqdXJam20Z+mT9b4533OChSZw4hwh8z+e41gRrR70NRVf+twnBNU+v8UlO sBMZOeOzQ934rQGxb0I1Kw+yQW3+wDtwprT76l+1XzwV5qL2MTDMOusR1+X/h7Hx18 XaMvSJ5FvOAe7su5XiYiGoHI5w0lE70f6tCG/mr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Johannes Berg , Sasha Levin Subject: [PATCH 4.19 04/12] mac80211: Drop frames from invalid MAC address in ad-hoc mode Date: Thu, 14 Oct 2021 16:54:04 +0200 Message-Id: <20211014145206.702722726@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014145206.566123760@linuxfoundation.org> References: <20211014145206.566123760@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: YueHaibing [ Upstream commit a6555f844549cd190eb060daef595f94d3de1582 ] WARNING: CPU: 1 PID: 9 at net/mac80211/sta_info.c:554 sta_info_insert_rcu+0x121/0x12a0 Modules linked in: CPU: 1 PID: 9 Comm: kworker/u8:1 Not tainted 5.14.0-rc7+ #253 Workqueue: phy3 ieee80211_iface_work RIP: 0010:sta_info_insert_rcu+0x121/0x12a0 ... Call Trace: ieee80211_ibss_finish_sta+0xbc/0x170 ieee80211_ibss_work+0x13f/0x7d0 ieee80211_iface_work+0x37a/0x500 process_one_work+0x357/0x850 worker_thread+0x41/0x4d0 If an Ad-Hoc node receives packets with invalid source MAC address, it hits a WARN_ON in sta_info_insert_check(), this can spam the log. Signed-off-by: YueHaibing Link: https://lore.kernel.org/r/20210827144230.39944-1-yuehaibing@huawei.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 012697efafc3..e0baa563a4de 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -3875,7 +3875,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) if (!bssid) return false; if (ether_addr_equal(sdata->vif.addr, hdr->addr2) || - ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2)) + ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2) || + !is_valid_ether_addr(hdr->addr2)) return false; if (ieee80211_is_beacon(hdr->frame_control)) return true; -- 2.33.0