Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808402/?format=api
{ "id": 808402, "url": "http://patchwork.ozlabs.org/api/patches/808402/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170831203013.9219-3-edumazet@google.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "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": "<20170831203013.9219-3-edumazet@google.com>", "list_archive_url": null, "date": "2017-08-31T20:30:13", "name": "[net-next,2/2] net: convert (struct ubuf_info)->refcnt to refcount_t", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "4b4d889795dbf433cbbd8014df8aa9877e443590", "submitter": { "id": 13357, "url": "http://patchwork.ozlabs.org/api/people/13357/?format=api", "name": "Eric Dumazet", "email": "edumazet@google.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170831203013.9219-3-edumazet@google.com/mbox/", "series": [ { "id": 902, "url": "http://patchwork.ozlabs.org/api/series/902/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=902", "date": "2017-08-31T20:30:11", "name": "net: ubuf_info.refcnt conversion", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/902/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808402/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808402/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>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"rahAA1bt\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjvBt2nvcz9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 1 Sep 2017 06:30:30 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751355AbdHaUa1 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 16:30:27 -0400", "from mail-pg0-f52.google.com ([74.125.83.52]:36916 \"EHLO\n\tmail-pg0-f52.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751053AbdHaUaZ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 31 Aug 2017 16:30:25 -0400", "by mail-pg0-f52.google.com with SMTP id 83so2018808pgb.4\n\tfor <netdev@vger.kernel.org>; Thu, 31 Aug 2017 13:30:25 -0700 (PDT)", "from localhost ([2620:15c:2cb:201:df6:9252:fc0d:50b2])\n\tby smtp.gmail.com with ESMTPSA id\n\tl11sm638200pfi.97.2017.08.31.13.30.24\n\t(version=TLS1_2 cipher=AES128-SHA bits=128/128);\n\tThu, 31 Aug 2017 13:30:24 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=google.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=zbvGxU9LayBB0xir4UyXbwhoRDZL7AfjOgxwc4XZE2o=;\n\tb=rahAA1bt1BLPXnw9Le7dFVr/iNNxkaPv6Ac/B5D4IjacD2YKADM5nk0R3t1lbxe+dk\n\totIyUpA2/Cx74vfrqVevbXLPQxEEYJV0pT/9zjRAuegY3T2a8HeSEtwrYJR/0VLXndO7\n\tH8WFrvKOB9W4hrZBhZJjZyXNzebzfw0ZdBQ+nRwKiFCAqxfOyCjHW0RgMLFfBYDAsmyn\n\tRKeuiRJcSAQTZ6WbmdL7YohUMrWtWkdePNwUh6qryEd8G3uaiK1u+6PuVk/0nLfwHPQr\n\tn3WJrxJGq+uv/am70KDOwxmds1fF4FhfnbolnVNMJ7agrsoCDTJkUvS1SSqV+40yYm86\n\tVpvA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=zbvGxU9LayBB0xir4UyXbwhoRDZL7AfjOgxwc4XZE2o=;\n\tb=AanEcJ3sVqAZ41MF0/2McwWv8gIMwr4PRhKXE5r3qZCjfq4K5qxYryB2Dot2RcdHXn\n\tyXq2GXxqWUyAr3sIxgFFTSVeryZCB3N2iDibk9Z2O6R7xFtBehDdCjUSz8enywapIIR5\n\tlqXIF+MW33edmWbGMtaWguhJbDl9TSQ2Uo1sUEqLhbfiYcNUNIn32BZqNCDqkTjay7y7\n\t8XjRuRYFBVvoTc/BJTWLHf+ZMKSEhGdA8yxw0qLucCkT9EjKLSDTK/CkecjK06O00acV\n\t3dF64+f7PPMhiVSbbMdLwXmEOt8TrwuknDWQZhdFjP/OJ4wOp3CAoKavrVKKKRaGDZav\n\tzsBA==", "X-Gm-Message-State": "AHYfb5j6H9EdCbYRGVyhRsMEwC5bBE5F5NY9nKVfs9uqH+IULhquVNZZ\n\t0zaEJIkUSHV87uWiOzuW4g==", "X-Google-Smtp-Source": "ADKCNb5eUDJQRxIIzPaFWxVrpVZtlzE+yslyUwdNuJbMM/rLcYi4f6HaLgV80Dgefrp/oNgjdZ3jew==", "X-Received": "by 10.98.245.132 with SMTP id b4mr3600287pfm.313.1504211425172; \n\tThu, 31 Aug 2017 13:30:25 -0700 (PDT)", "From": "Eric Dumazet <edumazet@google.com>", "To": "\"David S . Miller\" <davem@davemloft.net>", "Cc": "netdev <netdev@vger.kernel.org>, Willem de Bruijn <willemb@google.com>,\n\tEric Dumazet <edumazet@google.com>, Eric Dumazet <eric.dumazet@gmail.com>", "Subject": "[PATCH net-next 2/2] net: convert (struct ubuf_info)->refcnt to\n\trefcount_t", "Date": "Thu, 31 Aug 2017 13:30:13 -0700", "Message-Id": "<20170831203013.9219-3-edumazet@google.com>", "X-Mailer": "git-send-email 2.14.1.581.gf28d330327-goog", "In-Reply-To": "<20170831203013.9219-1-edumazet@google.com>", "References": "<20170831203013.9219-1-edumazet@google.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "refcount_t type and corresponding API should be\nused instead of atomic_t when the variable is used as\na reference counter. This allows to avoid accidental\nrefcounter overflows that might lead to use-after-free\nsituations.\n\nSigned-off-by: Eric Dumazet <edumazet@google.com>\n---\n include/linux/skbuff.h | 5 +++--\n net/core/skbuff.c | 8 ++++----\n 2 files changed, 7 insertions(+), 6 deletions(-)", "diff": "diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h\nindex 7594e19bce622a38dc39c054093c3da15b99b67b..316a92b45351f53709886ee0099cbc83b66f1b15 100644\n--- a/include/linux/skbuff.h\n+++ b/include/linux/skbuff.h\n@@ -22,6 +22,7 @@\n #include <linux/cache.h>\n #include <linux/rbtree.h>\n #include <linux/socket.h>\n+#include <linux/refcount.h>\n \n #include <linux/atomic.h>\n #include <asm/types.h>\n@@ -456,7 +457,7 @@ struct ubuf_info {\n \t\t\tu32 bytelen;\n \t\t};\n \t};\n-\tatomic_t refcnt;\n+\trefcount_t refcnt;\n \n \tstruct mmpin {\n \t\tstruct user_struct *user;\n@@ -472,7 +473,7 @@ struct ubuf_info *sock_zerocopy_realloc(struct sock *sk, size_t size,\n \n static inline void sock_zerocopy_get(struct ubuf_info *uarg)\n {\n-\tatomic_inc(&uarg->refcnt);\n+\trefcount_inc(&uarg->refcnt);\n }\n \n void sock_zerocopy_put(struct ubuf_info *uarg);\ndiff --git a/net/core/skbuff.c b/net/core/skbuff.c\nindex 65b9ca3945f8fd2b1bef4aef5dd774be04e5d128..ed86ca9afd9d8d1ac47983acf6006c179285a612 100644\n--- a/net/core/skbuff.c\n+++ b/net/core/skbuff.c\n@@ -963,7 +963,7 @@ struct ubuf_info *sock_zerocopy_alloc(struct sock *sk, size_t size)\n \tuarg->len = 1;\n \tuarg->bytelen = size;\n \tuarg->zerocopy = 1;\n-\tatomic_set(&uarg->refcnt, 1);\n+\trefcount_set(&uarg->refcnt, 1);\n \tsock_hold(sk);\n \n \treturn uarg;\n@@ -1086,7 +1086,7 @@ EXPORT_SYMBOL_GPL(sock_zerocopy_callback);\n \n void sock_zerocopy_put(struct ubuf_info *uarg)\n {\n-\tif (uarg && atomic_dec_and_test(&uarg->refcnt)) {\n+\tif (uarg && refcount_dec_and_test(&uarg->refcnt)) {\n \t\tif (uarg->callback)\n \t\t\tuarg->callback(uarg, uarg->zerocopy);\n \t\telse\n@@ -1108,7 +1108,7 @@ void sock_zerocopy_put_abort(struct ubuf_info *uarg)\n \t\t * avoid an skb send inside the main loop triggering uarg free.\n \t\t */\n \t\tif (sk->sk_type != SOCK_STREAM)\n-\t\t\tatomic_inc(&uarg->refcnt);\n+\t\t\trefcount_inc(&uarg->refcnt);\n \n \t\tsock_zerocopy_put(uarg);\n \t}\n@@ -1490,7 +1490,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,\n \t\tif (skb_orphan_frags(skb, gfp_mask))\n \t\t\tgoto nofrags;\n \t\tif (skb_zcopy(skb))\n-\t\t\tatomic_inc(&skb_uarg(skb)->refcnt);\n+\t\t\trefcount_inc(&skb_uarg(skb)->refcnt);\n \t\tfor (i = 0; i < skb_shinfo(skb)->nr_frags; i++)\n \t\t\tskb_frag_ref(skb, i);\n \n", "prefixes": [ "net-next", "2/2" ] }