Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp703098pxf; Wed, 31 Mar 2021 13:59:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiFLRlonISPA8+7qMHHF5ECUZ4/r+kQ4g/+n2A4jquAm/e8mKelgpCjtnY+J9qcmLbDaYi X-Received: by 2002:a05:6402:158d:: with SMTP id c13mr6036116edv.297.1617224377904; Wed, 31 Mar 2021 13:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617224377; cv=none; d=google.com; s=arc-20160816; b=rhGO/QzMqvmOgSUOcPui6OS4hMgNcqrQkz85Il04xLgB6Er47U28WFEfvbekYWcMBC 7kKBaKhFwl/DPYVDmgvw4c/JsAB1HFEbbaKbkylk5+4ffHUBw8gagGTaiztM76Hem8TQ GsYHUgRiJNS4F3suh4G58QbQe7e7kLZUYSP1YDCR1q2GJeCqzpKV2/GEaRcvq1PNxdPQ tmJiGnsRQKhFOFOFIPwG0ac00Qvx37dUBCP/h3YweeXOaRe0nxJjnePkl3u2ekG1V7G+ Qg6KrDAms8EGifPEJJ+tdu5VzKgYPaHaUWHUdC85GHCr4RroePSk6D/HBZ7Zolc7OOXF ZUBA== 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 :dkim-signature; bh=mT4tluRBtnUt1Hht/N0b0oYTLjqFC49X/aal5xVWArY=; b=EZmPzhd+iHVmiT9K2pUkLveAf5LWu5xVnP0MVhKhutZBUqhyIJ//PwfU9IIPqFAq1y Yg0q7ZtKsiox7NMnam0XJS0jssmQMQubk8+VYujOBEOzWmaBsWMDa/2+OTgWWSmRZZcv Gerbzi95VPTw243MYAE7RE30/1XZ90wOsxXgBQOps4B4Shbne9DQBetIL6vagODWIedw ILn//H8A950IXBZJfbEYSyTAvkEkNTXR1u/Dh5VaPzV2J3N8An5D4IulewNEAiL9DzHg STftZqzU3eAsY098DhwbAERgNJonz+RpJloXewJ1pLuS2r2XjeYcd8dt0fVUHNmlYBAs AtVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b5GSqZ4B; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si2355322eju.671.2021.03.31.13.59.16; Wed, 31 Mar 2021 13:59:37 -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=@redhat.com header.s=mimecast20190719 header.b=b5GSqZ4B; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbhCaUz5 (ORCPT + 99 others); Wed, 31 Mar 2021 16:55:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44896 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232259AbhCaUzy (ORCPT ); Wed, 31 Mar 2021 16:55:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617224154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mT4tluRBtnUt1Hht/N0b0oYTLjqFC49X/aal5xVWArY=; b=b5GSqZ4BfURHvb+pz1cJ42KmoTg96AAUbKn+pxuT8MAahw9hBb9ZYQGbY7q+FhuAlcY6E9 mcCQgk0zf+W5lPbMbCwLMsgGeQTtvqDHS0IZnXhbNeOXy3LBCLIXbYpixrDU8TwOEj3e1p FO0ZyYuF26Mw7lJvZkNXVOdOiVqzp18= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-73-4BfBflQfNcWGzJsvFQzhxQ-1; Wed, 31 Mar 2021 16:55:52 -0400 X-MC-Unique: 4BfBflQfNcWGzJsvFQzhxQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 162188189F1; Wed, 31 Mar 2021 20:55:50 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEC3B19C59; Wed, 31 Mar 2021 20:55:40 +0000 (UTC) Date: Wed, 31 Mar 2021 16:55:38 -0400 From: Richard Guy Briggs To: Pablo Neira Ayuso Cc: Linux-Audit Mailing List , LKML , netfilter-devel@vger.kernel.org, Paul Moore , Eric Paris , Steve Grubb , Florian Westphal , Phil Sutter , twoerner@redhat.com, tgraf@infradead.org, dan.carpenter@oracle.com, Jones Desougi Subject: Re: [PATCH v5] audit: log nftables configuration change events once per table Message-ID: <20210331205538.GJ3112383@madcap2.tricolour.ca> References: <28de34275f58b45fd4626a92ccae96b6d2b4e287.1616702731.git.rgb@redhat.com> <20210331204635.GA4634@salvia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210331204635.GA4634@salvia> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-31 22:46, Pablo Neira Ayuso wrote: > On Fri, Mar 26, 2021 at 01:38:59PM -0400, Richard Guy Briggs wrote: > > @@ -8006,12 +7966,65 @@ static void nft_commit_notify(struct net *net, u32 portid) > > WARN_ON_ONCE(!list_empty(&net->nft.notify_list)); > > } > > > > +static int nf_tables_commit_audit_alloc(struct list_head *adl, > > + struct nft_table *table) > > +{ > > + struct nft_audit_data *adp; > > + > > + list_for_each_entry(adp, adl, list) { > > + if (adp->table == table) > > + return 0; > > + } > > + adp = kzalloc(sizeof(*adp), GFP_KERNEL); > > + if (!adp) > > + return -ENOMEM; > > + adp->table = table; > > + INIT_LIST_HEAD(&adp->list); > > This INIT_LIST_HEAD is not required for an object that is going to be > inserted into the 'adl' list. > > > + list_add(&adp->list, adl); > > If no objections, I'll amend this patch. I'll include the UAF fix and > remove this unnecessary INIT_LIST_HEAD. Ok, so it is harmless other than being code noise and overhead, thanks again. - RGB -- Richard Guy Briggs Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635