Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5907738pxv; Thu, 29 Jul 2021 01:10:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEd+HpSubgYkpUSgXNdANB6FxsXzc2AJBIXJpwo0B4XddL30kF/lkScLkBGuwJ0HJzkXFs X-Received: by 2002:a6b:b2d7:: with SMTP id b206mr3146080iof.155.1627546248155; Thu, 29 Jul 2021 01:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627546248; cv=none; d=google.com; s=arc-20160816; b=S4xNVSSX2Y8TG7KUGi92yVWniiZ1BvwLA0YRtHlhd2MbHRGLbHUqrFJT2e+wYO7FaM Gkn8UCAJ1o5qwPjZTsvOwPpQcNZSYdPye0rwKpBqi3M/zaMHelV9A2F2s5RAx+7nrRPp WnatDi3uUX1RDw6rUpHbEsLr5J3DjA+DxrBn6Gw8087+DnAx5tnikcVsx8ozLNxdpbMG t9q9iMVitM6KWlOpXeEQpeHe2xrVS7bZJV9X94IBaj/XvIYOPjwfUmyu46SQmAExwFka TZmpGD1c2Hc2LQWfhcHlD9SA6ePy0vH17jU/ANHozexjkTB5NbG8Bhsm43MYGZYCG3w6 QuRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PD9LWizML9L5MrDPJV+ok5UnKuurD1Ks8gILlmhzIbk=; b=a/2rV5SBO8Ep6vbLGJXsGC9P2QYcStb5j6iMSY5FUaMfaHA2kpnmgqHNzuFzvN3FBA /Xmt403sxSAcUEmt2gAxcfmNr5TtFiTisFbYrxX8QaI8RsxnMnt9zki9Kpiz2Cpt7uS7 7bOfL3MsHI7/BFSwyctcRLqH+Ezze473EuQVlrG2alJ3gCL6pmi683ZvDAo8PtGReCRJ Vfo3QNd+hf8Rhj3jkmeShV5PPkp8jjeCLr+7hOP1n+Z7iyxSDSmskX1MbXCntfOdUpsG 8uF1gIOT6gvVhkzyF1/EKcd2BpXYTELobcuSpuL1HasIS6lk60b3w13r06uNgCzIrpSd tTDg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si2780726ion.22.2021.07.29.01.10.36; Thu, 29 Jul 2021 01:10:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234991AbhG2IIj (ORCPT + 99 others); Thu, 29 Jul 2021 04:08:39 -0400 Received: from mail.netfilter.org ([217.70.188.207]:40712 "EHLO mail.netfilter.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234917AbhG2IIj (ORCPT ); Thu, 29 Jul 2021 04:08:39 -0400 Received: from netfilter.org (bl11-146-165.dsl.telepac.pt [85.244.146.165]) by mail.netfilter.org (Postfix) with ESMTPSA id 50C916411D; Thu, 29 Jul 2021 10:08:03 +0200 (CEST) Date: Thu, 29 Jul 2021 10:08:29 +0200 From: Pablo Neira Ayuso To: Yajun Deng Cc: kadlec@netfilter.org, fw@strlen.de, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] netfilter: nf_conntrack_bridge: Fix memory leak when error Message-ID: <20210729080829.GA16912@salvia> References: <20210729074658.8538-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210729074658.8538-1-yajun.deng@linux.dev> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 29, 2021 at 03:46:58PM +0800, Yajun Deng wrote: > It should be added kfree_skb_list() when err is not equal to zero > in nf_br_ip_fragment(). > > v2: keep this aligned with IPv6. > > Fixes: 3c171f496ef5 ("netfilter: bridge: add connection tracking system") > Signed-off-by: Yajun Deng > --- > net/bridge/netfilter/nf_conntrack_bridge.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c > index 8d033a75a766..3cf5457919c6 100644 > --- a/net/bridge/netfilter/nf_conntrack_bridge.c > +++ b/net/bridge/netfilter/nf_conntrack_bridge.c > @@ -88,6 +88,11 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, > > skb = ip_fraglist_next(&iter); > } > + > + if (!err) > + return 0; > + > + kfree_skb_list(iter.frag_list); Actually: kfree_skb_list(iter.frag); I used frag_list instead of frag in my snippet. > return err; > } > slow_path: > -- > 2.32.0 >