Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3208164pxv; Sun, 25 Jul 2021 20:58:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpDkA6IIlSd3XC9R7QcE5aqydbH/uiYXlKelBuVq6A2E4qGkg8zi+QXd1YI4lmxR0OmdIg X-Received: by 2002:a92:de45:: with SMTP id e5mr9924965ilr.10.1627271912347; Sun, 25 Jul 2021 20:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627271912; cv=none; d=google.com; s=arc-20160816; b=rKR72jqXAzMTI2vtYHTcHUdr+WXHr2pbm2FCcQEY2kO+/FWbi7kr2kxyJfD30UmrUf 0EwP0HDkJgt8lwLv1oeged8MHnBhMLErMkoyEH/jh3/yfVd7Qo8Wit9NbX9vIgCBY5y+ faGb6Faugf3+oEQvaXmE69qvPNMrHV2JcW1v3wEbSx6lR/SCKmg/0/7nUCZ4V0QNuxKG /RCm1Q7Et/+S2lMiKMOBOcrPcqRFfFmqqb2/j3hwBvMxsPrlMrp6+5VuJ2XIYLAD4zVX Y8KUo9k04CP3VSAXJb0Ptsq7Zytgy4BWL6V170D7Xwnrh2XYlo24SGYJeW1tCdaUnSnx ql2w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=42/x3cunuNFrK5WXYNzv0PumgHH417h+iX4VfozjEqg=; b=tnZ6Ufai7H/T9p0Tz70wBW9HnylZHok5ULfJVIK397kXvPzQLjhz6jOvQJVgaB0RF+ D7v/eGl6LkwKXj8xNR1ZfJkgP1rQ6Aqg2rQ/SzrKEf/f4SHsovKskutYfIyTR0735TfA t2sDVw6x1odemk25eZK4Ji0VPtnPrEO5Q1vD5PB6kxyCAYhEEsCQTsXhRXKOYAzn6N6F Dvd0jXlsF8jEfv585Mg12B4zGQbUHVharVPFxa8HV1BB4vdhmj5mLmOkSPE5VDmUJCNw AV/jW7Bi1DoDl3gPgLYXXPC/fkGT4R3Cvxs8ehvwnO3c8zaOHekg1/qsBTqj2k4PDKRO 7efQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TTEDvxwL; 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=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si44005809ilk.94.2021.07.25.20.58.20; Sun, 25 Jul 2021 20:58:32 -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=@linux.dev header.s=key1 header.b=TTEDvxwL; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbhGZDQ5 (ORCPT + 99 others); Sun, 25 Jul 2021 23:16:57 -0400 Received: from out0.migadu.com ([94.23.1.103]:26221 "EHLO out0.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbhGZDQz (ORCPT ); Sun, 25 Jul 2021 23:16:55 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1627271839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=42/x3cunuNFrK5WXYNzv0PumgHH417h+iX4VfozjEqg=; b=TTEDvxwLws0uMFv8PMZ4WRAA59G66FCBFtiLFTvnsFeltMxFuQk7l7cp4tACqzT9nHNY5g M2zbbPyGukGSDcBtLh3VIHQ8lk+cSHfB5YjoJ9enWMDamCcWT0AnAWDS7+WhLFcSTcjQg0 5KGfiyhcz2rKOta51MylqUExs8RZlTY= From: Yajun Deng To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, roopa@nvidia.com, nikolay@nvidia.com, davem@davemloft.net, kuba@kernel.org Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] netfilter: nf_conntrack_bridge: Fix not free when error Date: Mon, 26 Jul 2021 11:57:02 +0800 Message-Id: <20210726035702.11964-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: yajun.deng@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It should be added kfree_skb_list() when err is not equal to zero in nf_br_ip_fragment(). Fixes: 3c171f496ef5 ("netfilter: bridge: add connection tracking system") Signed-off-by: Yajun Deng --- net/bridge/netfilter/nf_conntrack_bridge.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c index 8d033a75a766..059f53903eda 100644 --- a/net/bridge/netfilter/nf_conntrack_bridge.c +++ b/net/bridge/netfilter/nf_conntrack_bridge.c @@ -83,12 +83,16 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, skb->tstamp = tstamp; err = output(net, sk, data, skb); - if (err || !iter.frag) - break; - + if (err) { + kfree_skb_list(iter.frag); + return err; + } + + if (!iter.frag) + return 0; + skb = ip_fraglist_next(&iter); } - return err; } slow_path: /* This is a linearized skbuff, the original geometry is lost for us. -- 2.32.0