lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210713132059.GB11179@breakpoint.cc>
Date:   Tue, 13 Jul 2021 15:20:59 +0200
From:   Florian Westphal <fw@...len.de>
To:     Dongliang Mu <mudongliangabcd@...il.com>
Cc:     Pablo Neira Ayuso <pablo@...filter.org>,
        Jozsef Kadlecsik <kadlec@...filter.org>,
        Florian Westphal <fw@...len.de>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Richard Guy Briggs <rgb@...hat.com>,
        Paul Moore <paul@...l-moore.com>,
        syzbot <syzkaller@...glegroups.com>,
        kernel test robot <lkp@...el.com>,
        netfilter-devel@...r.kernel.org, coreteam@...filter.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] audit: fix memory leak in nf_tables_commit

Dongliang Mu <mudongliangabcd@...il.com> wrote:
> In nf_tables_commit, if nf_tables_commit_audit_alloc fails, it does not
> free the adp variable.
> 
> Fix this by freeing the linked list with head 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
> 
> Reported-by: syzbot <syzkaller@...glegroups.com>
> Reported-by: kernel test robot <lkp@...el.com>
> Fixes: c520292f29b8 ("audit: log nftables configuration change events once per table")
> Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
> ---
> v1->v2: fix the compile issue
>  net/netfilter/nf_tables_api.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> index 390d4466567f..7f45b291be13 100644
> --- a/net/netfilter/nf_tables_api.c
> +++ b/net/netfilter/nf_tables_api.c
> @@ -8444,6 +8444,16 @@ static int nf_tables_commit_audit_alloc(struct list_head *adl,
>  	return 0;
>  }
>  
> +static void nf_tables_commit_free(struct list_head *adl)

nf_tables_commit_audit_free?

Aside from that, there should be a followup patch (for nf-next),
adding empty inline functions in case of CONFIG_AUDITSYSCALL=n.

Right now it does pointless aggregation for the AUDIT=n case.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ