Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/809396/?format=api
{ "id": 809396, "url": "http://patchwork.ozlabs.org/api/1.2/patches/809396/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/1504477667-12130-8-git-send-email-pablo@netfilter.org/", "project": { "id": 26, "url": "http://patchwork.ozlabs.org/api/1.2/projects/26/?format=api", "name": "Netfilter Development", "link_name": "netfilter-devel", "list_id": "netfilter-devel.vger.kernel.org", "list_email": "netfilter-devel@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504477667-12130-8-git-send-email-pablo@netfilter.org>", "list_archive_url": null, "date": "2017-09-03T22:27:17", "name": "[17/47] netfilter: nf_tables: Allow set names of up to 255 chars", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0acbbee65990e2912d9d4e1bc457dbb12301f717", "submitter": { "id": 1315, "url": "http://patchwork.ozlabs.org/api/1.2/people/1315/?format=api", "name": "Pablo Neira Ayuso", "email": "pablo@netfilter.org" }, "delegate": { "id": 6139, "url": "http://patchwork.ozlabs.org/api/1.2/users/6139/?format=api", "username": "pablo", "first_name": "Pablo", "last_name": "Neira", "email": "pablo@netfilter.org" }, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/1504477667-12130-8-git-send-email-pablo@netfilter.org/mbox/", "series": [ { "id": 1280, "url": "http://patchwork.ozlabs.org/api/1.2/series/1280/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=1280", "date": "2017-09-03T22:25:42", "name": "[01/47] netfilter: expect: add to hash table after expect init", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1280/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/809396/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/809396/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netfilter-devel-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.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=netfilter-devel-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 3xlngS6GHGz9s06\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 4 Sep 2017 08:28:20 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753279AbdICW2T (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 3 Sep 2017 18:28:19 -0400", "from mail.us.es ([193.147.175.20]:51214 \"EHLO mail.us.es\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1753269AbdICW2R (ORCPT <rfc822; netfilter-devel@vger.kernel.org>);\n\tSun, 3 Sep 2017 18:28:17 -0400", "from antivirus1-rhel7.int (unknown [192.168.2.11])\n\tby mail.us.es (Postfix) with ESMTP id ADE64190F61\n\tfor <netfilter-devel@vger.kernel.org>;\n\tMon, 4 Sep 2017 00:27:49 +0200 (CEST)", "from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 9D901B502D\n\tfor <netfilter-devel@vger.kernel.org>;\n\tMon, 4 Sep 2017 00:27:49 +0200 (CEST)", "by antivirus1-rhel7.int (Postfix, from userid 99)\n\tid 9330EB5027; Mon, 4 Sep 2017 00:27:49 +0200 (CEST)", "from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 82F8BDA2AF;\n\tMon, 4 Sep 2017 00:27:47 +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\tMon, 04 Sep 2017 00:27:47 +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 29E754265A20;\n\tMon, 4 Sep 2017 00:27:47 +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 17/47] netfilter: nf_tables: Allow set names of up to 255\n\tchars", "Date": "Mon, 4 Sep 2017 00:27:17 +0200", "Message-Id": "<1504477667-12130-8-git-send-email-pablo@netfilter.org>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1504477667-12130-1-git-send-email-pablo@netfilter.org>", "References": "<1504477667-12130-1-git-send-email-pablo@netfilter.org>", "X-Virus-Scanned": "ClamAV using ClamSMTP", "Sender": "netfilter-devel-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netfilter-devel.vger.kernel.org>", "X-Mailing-List": "netfilter-devel@vger.kernel.org" }, "content": "From: Phil Sutter <phil@nwl.cc>\n\nSame conversion as for table names, use NFT_NAME_MAXLEN as upper\nboundary as well.\n\nSigned-off-by: Phil Sutter <phil@nwl.cc>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n include/net/netfilter/nf_tables.h | 2 +-\n include/uapi/linux/netfilter/nf_tables.h | 2 +-\n net/netfilter/nf_tables_api.c | 18 ++++++++++++++----\n 3 files changed, 16 insertions(+), 6 deletions(-)", "diff": "diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h\nindex be1610162ee0..66ba62fa7d90 100644\n--- a/include/net/netfilter/nf_tables.h\n+++ b/include/net/netfilter/nf_tables.h\n@@ -396,7 +396,7 @@ void nft_unregister_set(struct nft_set_type *type);\n struct nft_set {\n \tstruct list_head\t\tlist;\n \tstruct list_head\t\tbindings;\n-\tchar\t\t\t\tname[NFT_SET_MAXNAMELEN];\n+\tchar\t\t\t\t*name;\n \tu32\t\t\t\tktype;\n \tu32\t\t\t\tdtype;\n \tu32\t\t\t\tobjtype;\ndiff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h\nindex d9c03a8608ee..b5e73e80b7b6 100644\n--- a/include/uapi/linux/netfilter/nf_tables.h\n+++ b/include/uapi/linux/netfilter/nf_tables.h\n@@ -4,7 +4,7 @@\n #define NFT_NAME_MAXLEN\t\t256\n #define NFT_TABLE_MAXNAMELEN\tNFT_NAME_MAXLEN\n #define NFT_CHAIN_MAXNAMELEN\tNFT_NAME_MAXLEN\n-#define NFT_SET_MAXNAMELEN\t32\n+#define NFT_SET_MAXNAMELEN\tNFT_NAME_MAXLEN\n #define NFT_OBJ_MAXNAMELEN\t32\n #define NFT_USERDATA_MAXLEN\t256\n \ndiff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c\nindex 747499039709..e6a07f27b1a3 100644\n--- a/net/netfilter/nf_tables_api.c\n+++ b/net/netfilter/nf_tables_api.c\n@@ -2650,7 +2650,7 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,\n \tunsigned long *inuse;\n \tunsigned int n = 0, min = 0;\n \n-\tp = strnchr(name, NFT_SET_MAXNAMELEN, '%');\n+\tp = strchr(name, '%');\n \tif (p != NULL) {\n \t\tif (p[1] != 'd' || strchr(p + 2, '%'))\n \t\t\treturn -EINVAL;\n@@ -2681,7 +2681,10 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,\n \t\tfree_page((unsigned long)inuse);\n \t}\n \n-\tsnprintf(set->name, sizeof(set->name), name, min + n);\n+\tset->name = kasprintf(GFP_KERNEL, name, min + n);\n+\tif (!set->name)\n+\t\treturn -ENOMEM;\n+\n \tlist_for_each_entry(i, &ctx->table->sets, list) {\n \t\tif (!nft_is_active_next(ctx->net, i))\n \t\t\tcontinue;\n@@ -2958,7 +2961,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,\n \tstruct nft_table *table;\n \tstruct nft_set *set;\n \tstruct nft_ctx ctx;\n-\tchar name[NFT_SET_MAXNAMELEN];\n+\tchar *name;\n \tunsigned int size;\n \tbool create;\n \tu64 timeout;\n@@ -3104,8 +3107,14 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,\n \t\tgoto err1;\n \t}\n \n-\tnla_strlcpy(name, nla[NFTA_SET_NAME], sizeof(set->name));\n+\tname = nla_strdup(nla[NFTA_SET_NAME], GFP_KERNEL);\n+\tif (!name) {\n+\t\terr = -ENOMEM;\n+\t\tgoto err2;\n+\t}\n+\n \terr = nf_tables_set_alloc_name(&ctx, set, name);\n+\tkfree(name);\n \tif (err < 0)\n \t\tgoto err2;\n \n@@ -3155,6 +3164,7 @@ static void nft_set_destroy(struct nft_set *set)\n {\n \tset->ops->destroy(set);\n \tmodule_put(set->ops->type->owner);\n+\tkfree(set->name);\n \tkvfree(set);\n }\n \n", "prefixes": [ "17/47" ] }