Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp862880pxb; Tue, 1 Feb 2022 12:01:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxe1J6bO1LqpmbHS/f0lUvI5nrCVymmkWnnKh3j6vAlWQUH222jvsAZGdHsfsk6HOJr7DOt X-Received: by 2002:aa7:8a14:: with SMTP id m20mr26529569pfa.63.1643745666018; Tue, 01 Feb 2022 12:01:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745666; cv=none; d=google.com; s=arc-20160816; b=BWtfTRcbj67QeCuP9vlKG8lo5fmpZ+CuPHQZJ0agpXI1M21YorqL5DzDCf1x1Txf6p R3m/y/eY2hEH1RkENkfGOLyFEyVfaXzDwX6WIIjvMh4J6Kg+S338iC0UYnV/XqCMIZiT JRsEIuQsnXb6ZgBkUEIfZiwvT+kRNCeSolDEwlvj0YNmAhcp+EawjcwtgC1QGItGMvnv JHCDliG6v7BpHfTpcS35/rOacwnq0ot90vg7RMtUb9pEhoIIrVlAPOKEFrGf1dy8gND1 yTHlfjCCP5feOOf35VxGQRivmClWyrwSe8P9Ky77WbSEp9A5OGradvgTvVTHXls4Id2t YlgA== 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=8pn6BkC5HB0QQbryqurGrjy/BntAx8lrWqiVpntaBg8=; b=huyMT5jFzc3Hstak2c11Acrd7d6Rm8vincDtUg6caTMEP1Mz1gyAy/l16IKZTggq5L M727vvWGPle69+YITwkH3fmV45IiCyUCRwhgFf8P9OTot0f9aYkA+Kd8aG6NZeTr9rCL Y2VOt1rJkUX3dQZ3iBBKZ2qUMvSBQ7WVp4fcWbBqUBkkeyx7b9p+kpPthKsFMswAuLoO RXKR2jNIW4IkaFKB//vfdYlaT6JeqDHJBEmzNUXwhK99ojTaNEW+LgxcJfqzBMbFJ42j iHAoZSM+rpuga7ULF0B5qeSD+wbCpGu/ZcNZf+vkOL81GqHcwWsSnWuNL9W+IlF4R8j5 Vbrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yOMDMKGS; 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 g14si17970689pfc.253.2022.02.01.12.00.54; Tue, 01 Feb 2022 12:01:06 -0800 (PST) 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=yOMDMKGS; 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 S1376505AbiAaLMx (ORCPT + 99 others); Mon, 31 Jan 2022 06:12:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377043AbiAaLJb (ORCPT ); Mon, 31 Jan 2022 06:09:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 289ECC0604C2; Mon, 31 Jan 2022 03:06:11 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id AB087B82A71; Mon, 31 Jan 2022 11:06:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3B50C340E8; Mon, 31 Jan 2022 11:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627169; bh=RU/aoYH9VVAzoILzyFoXl7OLpyGsCBshNoSXoZibb58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOMDMKGSBObc2qqfBg7hFwSY2MMf6DTFE5pRkwLCz0Gl/t0VUdZDUNbi35Msx7jeF rjKsSkViATkAw7cOPA+p1OH4AlQkcrc6+UV8gMTSFOwclZ0xqC11NXY15QtwDLb2Vi LuBhn3ygnG4i4/cN9VDEG7gIcl99hW5lMW3/YdKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Yi , Nikolay Aleksandrov , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 096/100] net: bridge: vlan: fix memory leak in __allowed_ingress Date: Mon, 31 Jan 2022 11:56:57 +0100 Message-Id: <20220131105223.675973580@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@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: Tim Yi [ Upstream commit fd20d9738395cf8e27d0a17eba34169699fccdff ] When using per-vlan state, if vlan snooping and stats are disabled, untagged or priority-tagged ingress frame will go to check pvid state. If the port state is forwarding and the pvid state is not learning/forwarding, untagged or priority-tagged frame will be dropped but skb memory is not freed. Should free skb when __allowed_ingress returns false. Fixes: a580c76d534c ("net: bridge: vlan: add per-vlan state") Signed-off-by: Tim Yi Acked-by: Nikolay Aleksandrov Link: https://lore.kernel.org/r/20220127074953.12632-1-tim.yi@pica8.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/bridge/br_vlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 1f508d998fb2d..852f4b54e8811 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -543,10 +543,10 @@ static bool __allowed_ingress(const struct net_bridge *br, if (!br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { if (*state == BR_STATE_FORWARDING) { *state = br_vlan_get_pvid_state(vg); - return br_vlan_state_allowed(*state, true); - } else { - return true; + if (!br_vlan_state_allowed(*state, true)) + goto drop; } + return true; } } v = br_vlan_find(vg, *vid); -- 2.34.1