Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1758041pxv; Fri, 16 Jul 2021 17:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKxw0nNhpqo1Kp8baW2G1Cavytt4RR9Piz3IirKsVVob4+GXtcDZDoWpT9SPKFO//0uiZm X-Received: by 2002:a17:906:1156:: with SMTP id i22mr14949542eja.167.1626481493689; Fri, 16 Jul 2021 17:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626481493; cv=none; d=google.com; s=arc-20160816; b=Rwel8u3Gfzs2qSVno0dynsbPsgOD7IjXSm0RpdtxC2paAThXQxvkr14ej4Mlk4falY NAPDPLAyT4BlN80aHziQi/ibDvbMtJmxA2cVsFhhN/kS7Aglhzg6K8bS1o1JdqIGnYWY cdhdo2BBvA+EnkIkW4TT/7UARV6nkkF6A3jJoRjYBLRDcFcRonEzgAnvgm17hNrfI3g5 t7XzaKuQSarZPrUUnkD2Cnrz71dAu00QKefVGgwpYMluXH8XB7ZKQ0OC7qRXpJ8f98Di 1BurKywAWxpw4msWDR5Gn+H0ZQSO8leLkmb9m9acKOjaFmIPeY3oBRr7CzxTHIfCqDBp Yuxg== 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=6798Vitu9q9QNJ8dmbzPxT6fz+ENyRxYOcx44tfHuss=; b=ERHuZvY/eoRcgJfk9DeyxFwC++kGsz337mmrEYRnQPcMPCSN25vKSLK+cXfMf05Dns Jl8N76wsHbDE/z/c8Zb7Ba2dHg0PpCDKvbULPrpgRoZG422R6iRztwbxZhxAOMeBcNS1 mxtZMCm+dy0xr/eHrtm0mW/U+lGGy6tW6i/L7FdZchOhTRsm1q/vygrimLg1NbWorOz0 Ss/KbYPXmfQ4A1yfmHWT/ESCYUoan07qSZLOsrmZ9JTNuE3It60mYbRRba0jUUvMoBsO 9uwsMxC4yRyc7NxIl+ISopD/OKTFLp2e0XM/nBIKZCQy13Eat2CK+6M2hcbgyX4GYq4N 60jQ== 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 jz19si1192195ejb.37.2021.07.16.17.24.30; Fri, 16 Jul 2021 17:24:53 -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 S230014AbhGQAZm (ORCPT + 99 others); Fri, 16 Jul 2021 20:25:42 -0400 Received: from mail.netfilter.org ([217.70.188.207]:45700 "EHLO mail.netfilter.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbhGQAZl (ORCPT ); Fri, 16 Jul 2021 20:25:41 -0400 Received: from netfilter.org (unknown [90.77.255.23]) by mail.netfilter.org (Postfix) with ESMTPSA id 0725D6164C; Sat, 17 Jul 2021 02:22:25 +0200 (CEST) Date: Sat, 17 Jul 2021 02:22:43 +0200 From: Pablo Neira Ayuso To: Dongliang Mu Cc: Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Jakub Kicinski , Richard Guy Briggs , Paul Moore , syzbot , kernel test robot , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] audit: fix memory leak in nf_tables_commit Message-ID: <20210717002243.GA27401@salvia> References: <20210714032703.505023-1-mudongliangabcd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210714032703.505023-1-mudongliangabcd@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 14, 2021 at 11:27:03AM +0800, Dongliang Mu wrote: > In nf_tables_commit, if nf_tables_commit_audit_alloc fails, it does not > free the adp variable. > > Fix this by adding nf_tables_commit_audit_free which frees > the linked list with the head node adl. > > backtrace: > kmalloc include/linux/slab.h:591 [inline] > kzalloc include/linux/slab.h:721 [inline] > nf_tables_commit_audit_alloc net/netfilter/nf_tables_api.c:8439 [inline] > nf_tables_commit+0x16e/0x1760 net/netfilter/nf_tables_api.c:8508 > nfnetlink_rcv_batch+0x512/0xa80 net/netfilter/nfnetlink.c:562 > nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] > nfnetlink_rcv+0x1fa/0x220 net/netfilter/nfnetlink.c:652 > netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] > netlink_unicast+0x2c7/0x3e0 net/netlink/af_netlink.c:1340 > netlink_sendmsg+0x36b/0x6b0 net/netlink/af_netlink.c:1929 > sock_sendmsg_nosec net/socket.c:702 [inline] > sock_sendmsg+0x56/0x80 net/socket.c:722 Applied, thanks.