Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2172869yba; Mon, 22 Apr 2019 01:36:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUTECDivLFPedxo71c+2GNs5or6Olq1oSID1RRaBU73lAEBTqjyEPmK9NKzl333yFPvkfl X-Received: by 2002:a62:6444:: with SMTP id y65mr19441039pfb.56.1555922202001; Mon, 22 Apr 2019 01:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555922201; cv=none; d=google.com; s=arc-20160816; b=VTX8BygCtLNnhyJ+BHo0FBeaBUYpJ53yYHgkePp873NUEulK6LxrwX4DT9AUcOGLvp 5gNKygjXg6foLdhE1tF4kYt6ysJzqYJ+LE9n2Gb9i+aOXsoTn5x4iD3mpr+CmfpggScp 9rVTX7AlW0EWQUUvqmpj1OaZAuEVYk7YnXkFFcR9WqBEVmmyL+ODj3VlQfDCLUhjFNcL NXLBF2tkWz8JybgQQxmg1NwSugZYcOLJqr92KdRYFy0X+D3Qnhcdiv5Z5s7nWsSP2PHj slbUoLrxFyfRq6/Zm8q2ugELX5BKeHsgWh5DNUFx5N42xJ3bYB63fTDA268gHPggyWdh +2KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Lg36TDmQqeDxmyisTrK/RwJ96e+cZOMxU05StqhR/98=; b=UmXFjrZp2bPOB8hqOIgMpJSFplkTNHKjkUoYkcDFWGz7gXWX1we8HtcocJzgz8kMav doWX8D23kPwAq1qnutpq6wzfjB+mqAc0yMCVTC6Yu+mi8f4IO/oMNDf1vloePeZ6Qhi+ fXZAOx6J6q8kXRwsuL4KPhVb+KCBq3dUchGbxb2JM/uL3gRgbAkg7cl8dymQqhn5QuZx FwlQLB4JBcrzAXl6LPJUZptt6wCojRdC5E9TF/agDvAbu4K5rcFMdWu7rONTh3olDm5p DEUQ8rij9zroithJpJ2nRAXqO+W0tTO45RCJPM+Za0jxUit1/KbKWRya2kXm1ta1X9rc 3mkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si13061500ple.415.2019.04.22.01.36.26; Mon, 22 Apr 2019 01:36:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbfDVIeE (ORCPT + 99 others); Mon, 22 Apr 2019 04:34:04 -0400 Received: from mail.us.es ([193.147.175.20]:40322 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbfDVIeE (ORCPT ); Mon, 22 Apr 2019 04:34:04 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 23FED27F8AA for ; Mon, 22 Apr 2019 10:34:02 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 0EEC8DA709 for ; Mon, 22 Apr 2019 10:34:02 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 0E103DA708; Mon, 22 Apr 2019 10:34:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id D7CB7DA705; Mon, 22 Apr 2019 10:33:59 +0200 (CEST) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Mon, 22 Apr 2019 10:33:59 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from us.es (sys.soleta.eu [212.170.55.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 1984lsi) by entrada.int (Postfix) with ESMTPSA id AD7F44265A31; Mon, 22 Apr 2019 10:33:59 +0200 (CEST) Date: Mon, 22 Apr 2019 10:33:59 +0200 X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: Rundong Ge Cc: kadlec@blackhole.kfki.hu, fw@strlen.de, roopa@cumulusnetworks.com, davem@davemloft.net, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] netfilter: fix dangling pointer access of fake_rtable Message-ID: <20190422083339.ptkxqb66pombgy5g@salvia> References: <20190409065612.32652-1-rdong.ge@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190409065612.32652-1-rdong.ge@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 09, 2019 at 06:56:12AM +0000, Rundong Ge wrote: [...] > diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c > index 0dcc359..57eb02d 100644 > --- a/net/netfilter/nfnetlink_queue.c > +++ b/net/netfilter/nfnetlink_queue.c > @@ -905,13 +905,25 @@ static void free_entry(struct nf_queue_entry *entry) > dev_cmp(struct nf_queue_entry *entry, unsigned long ifindex) > { > #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) > - int physinif, physoutif; > + struct net_device *physindev, *physoutdev; > + struct net_bridge_port *port; > > - physinif = nf_bridge_get_physinif(entry->skb); > - physoutif = nf_bridge_get_physoutif(entry->skb); > - > - if (physinif == ifindex || physoutif == ifindex) > - return 1; > + physindev = nf_bridge_get_physindev(entry->skb); > + physoutdev = nf_bridge_get_physoutdev(entry->skb); > + if (physindev) { > + if (physindev->ifindex == ifindex) > + return 1; > + port = br_port_get_rcu(physindev); > + if (port && port->br->dev->ifindex == ifindex) > + return 1; > + } > + if (physoutdev) { > + if (physoutdev->ifindex == ifindex) > + return 1; > + port = br_port_get_rcu(physoutdev); > + if (port && port->br->dev->ifindex == ifindex) > + return 1; > + } Either entry->state.in and entry->state.out point to the bridge device, after this #endif. > #endif > if (entry->state.in) > if (entry->state.in->ifindex == ifindex) > -- > 1.8.3.1 >