{"id":809362,"url":"http://patchwork.ozlabs.org/api/patches/809362/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1504475761-11454-2-git-send-email-pablo@netfilter.org/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504475761-11454-2-git-send-email-pablo@netfilter.org>","list_archive_url":null,"date":"2017-09-03T21:56:00","name":"[nf-next,4/5] netfilter: nf_tables: use NLM_F_NONREC for deletion requests","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"964c445ffaa5e3574fb49c0478615f0dfa4c4e66","submitter":{"id":1315,"url":"http://patchwork.ozlabs.org/api/people/1315/?format=json","name":"Pablo Neira Ayuso","email":"pablo@netfilter.org"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1504475761-11454-2-git-send-email-pablo@netfilter.org/mbox/","series":[{"id":1278,"url":"http://patchwork.ozlabs.org/api/series/1278/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=1278","date":"2017-09-03T21:55:59","name":null,"version":1,"mbox":"http://patchwork.ozlabs.org/series/1278/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809362/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809362/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlmyf3Ybcz9sPs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon,  4 Sep 2017 07:56:26 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753052AbdICV4U (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 3 Sep 2017 17:56:20 -0400","from mail.us.es ([193.147.175.20]:47202 \"EHLO mail.us.es\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1752983AbdICV4S (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tSun, 3 Sep 2017 17:56:18 -0400","from antivirus1-rhel7.int (unknown [192.168.2.11])\n\tby mail.us.es (Postfix) with ESMTP id 94C0811D8F6\n\tfor <netdev@vger.kernel.org>; Sun,  3 Sep 2017 23:55:51 +0200 (CEST)","from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 85EA1B5027\n\tfor <netdev@vger.kernel.org>; Sun,  3 Sep 2017 23:55:51 +0200 (CEST)","by antivirus1-rhel7.int (Postfix, from userid 99)\n\tid 765DCB502C; Sun,  3 Sep 2017 23:55:51 +0200 (CEST)","from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 66D63B5027;\n\tSun,  3 Sep 2017 23:55:49 +0200 (CEST)","from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int\n\t(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); \n\tSun, 03 Sep 2017 23:55:49 +0200 (CEST)","from salvia.here (unknown [31.4.193.113])\n\t(Authenticated sender: pneira@us.es)\n\tby entrada.int (Postfix) with ESMTPA id EB77D4265A24;\n\tSun,  3 Sep 2017 23:55:48 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.1 (2015-04-28) on\n\tantivirus1-rhel7.int","X-Spam-Level":"","X-Spam-Status":"No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50,\n\tSMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1","X-Virus-Status":"clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int)","X-SMTPAUTHUS":"auth mail.us.es","From":"Pablo Neira Ayuso <pablo@netfilter.org>","To":"netfilter-devel@vger.kernel.org","Cc":"davem@davemloft.net, netdev@vger.kernel.org","Subject":"[PATCH nf-next 4/5] netfilter: nf_tables: use NLM_F_NONREC for\n\tdeletion requests","Date":"Sun,  3 Sep 2017 23:56:00 +0200","Message-Id":"<1504475761-11454-2-git-send-email-pablo@netfilter.org>","X-Mailer":"git-send-email 2.1.4","In-Reply-To":"<1504475761-11454-1-git-send-email-pablo@netfilter.org>","References":"<1504475761-11454-1-git-send-email-pablo@netfilter.org>","X-Virus-Scanned":"ClamAV using ClamSMTP","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Bail out if user requests non-recursive deletion for tables and sets.\nThis new flags tells nf_tables netlink interface to reject deletions if\ntables and sets have content.\n\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n net/netfilter/nf_tables_api.c | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)","diff":"diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c\nindex 8b86acbb9770..2ea043e5b344 100644\n--- a/net/netfilter/nf_tables_api.c\n+++ b/net/netfilter/nf_tables_api.c\n@@ -860,6 +860,10 @@ static int nf_tables_deltable(struct net *net, struct sock *nlsk,\n \tif (IS_ERR(table))\n \t\treturn PTR_ERR(table);\n \n+\tif (nlh->nlmsg_flags & NLM_F_NONREC &&\n+\t    table->use > 0)\n+\t\treturn -EBUSY;\n+\n \tctx.afi = afi;\n \tctx.table = table;\n \n@@ -3225,7 +3229,9 @@ static int nf_tables_delset(struct net *net, struct sock *nlsk,\n \tset = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_NAME], genmask);\n \tif (IS_ERR(set))\n \t\treturn PTR_ERR(set);\n-\tif (!list_empty(&set->bindings))\n+\n+\tif (!list_empty(&set->bindings) ||\n+\t    (nlh->nlmsg_flags & NLM_F_NONREC && atomic_read(&set->nelems) > 0))\n \t\treturn -EBUSY;\n \n \treturn nft_delset(&ctx, set);\n","prefixes":["nf-next","4/5"]}