get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/806596/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 806596,
    "url": "http://patchwork.ozlabs.org/api/patches/806596/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170828141143.14143.89655.stgit@john-Precision-Tower-5810/",
    "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": "<20170828141143.14143.89655.stgit@john-Precision-Tower-5810>",
    "list_archive_url": null,
    "date": "2017-08-28T14:11:43",
    "name": "[net-next,6/9] bpf: harden sockmap program attach to ensure correct map type",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "be61f81058b654b79d863d0fe20ed8f139be1157",
    "submitter": {
        "id": 20028,
        "url": "http://patchwork.ozlabs.org/api/people/20028/?format=api",
        "name": "John Fastabend",
        "email": "john.fastabend@gmail.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/20170828141143.14143.89655.stgit@john-Precision-Tower-5810/mbox/",
    "series": [
        {
            "id": 179,
            "url": "http://patchwork.ozlabs.org/api/series/179/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=179",
            "date": "2017-08-28T14:09:45",
            "name": "sockmap UAPI updates and fixes",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/179/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806596/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806596/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=gmail.com header.i=@gmail.com\n\theader.b=\"asHW8lvG\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgtxW10lHz9s1h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 00:11:59 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751419AbdH1OL5 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 28 Aug 2017 10:11:57 -0400",
            "from mail-pf0-f194.google.com ([209.85.192.194]:36636 \"EHLO\n\tmail-pf0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751232AbdH1OL4 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 28 Aug 2017 10:11:56 -0400",
            "by mail-pf0-f194.google.com with SMTP id k3so395043pfc.3\n\tfor <netdev@vger.kernel.org>; Mon, 28 Aug 2017 07:11:55 -0700 (PDT)",
            "from [127.0.1.1] ([72.168.144.1]) by smtp.gmail.com with ESMTPSA id\n\tu6sm1310905pgo.35.2017.08.28.07.11.49\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 28 Aug 2017 07:11:54 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-transfer-encoding;\n\tbh=4FiyVPaVPJUEq+3MCIsX9rYBwpWEoHPVp9XNdxLq3uY=;\n\tb=asHW8lvGSUe4MUIZveWrbSekSmFe3BiC3ihVQsvDhC8x7NysTDf/Hm50kC2xX/kMIZ\n\ttgrZ8SRM6Kcfs7EbO/iOYO9jI7tEAzMdi505F0lJAjzn4iEdfSmGkHJccF2GybZRHLeV\n\tOwkpUdpgUFuhM15Vmx3mUKnNwV6g+NXuDNZZbGdYWJrmwoQDiAfSoAPpyQ3RRyV7F81a\n\t+UOrVeRBlLV70+s9fejVeHSWtHKiyTGRCkifAIAGJ0nQBz/jGaD/VdNgkqTBJf1/U5c7\n\t5rDwO2rKPV/gMroVrgY91EusCMJEAsQIlQnvPeZMhZxtpvBi1BShGp1t8/v6NOAS4Cja\n\t4Uxg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-transfer-encoding;\n\tbh=4FiyVPaVPJUEq+3MCIsX9rYBwpWEoHPVp9XNdxLq3uY=;\n\tb=qqccG6fAKUL7eFwV/XQ3+y2R0yU4rRSQHcAnlgOUbZrDZZsuY5iC7fu4YiAGBmvlFg\n\tshTC74HvHK/RvQDiFF4o5ML5kzDbFTs9ajBMThn3tMXdf96+tW8esQudd15+h/66omy0\n\t2bXwjEA44wdwgXKlCERKTyBteugEE6hTj3/S+O2Y0CvIovbdGtqiIQwoSDIqE9MZ1t8l\n\teuffoY/Bfg04yt31gKfd2zSizAOlo/AaB8WFd9gQX3ARsaNmhTl/i8i1hTF2k52VfGn7\n\t/Q5wqbLZx+n2ftughb/30Wyfm1XCB/UWCT9YGb4wDDvs2IkfFZ9OwjI2+c9NYRXlOMCi\n\tImMA==",
        "X-Gm-Message-State": "AHYfb5h3qe8SH2fjgCXwwu4j3o2zSwQgFXyO8nr80EH32YfK67Inavyf\n\tI4qnDGFxKFLPkZvT",
        "X-Received": "by 10.84.217.79 with SMTP id e15mr932634plj.316.1503929515455;\n\tMon, 28 Aug 2017 07:11:55 -0700 (PDT)",
        "Subject": "[net-next PATCH 6/9] bpf: harden sockmap program attach to ensure\n\tcorrect map type",
        "From": "John Fastabend <john.fastabend@gmail.com>",
        "To": "ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net",
        "Cc": "netdev@vger.kernel.org, john.fastabend@gmail.com",
        "Date": "Mon, 28 Aug 2017 07:11:43 -0700",
        "Message-ID": "<20170828141143.14143.89655.stgit@john-Precision-Tower-5810>",
        "In-Reply-To": "<20170828140850.14143.83953.stgit@john-Precision-Tower-5810>",
        "References": "<20170828140850.14143.83953.stgit@john-Precision-Tower-5810>",
        "User-Agent": "StGit/0.17.1-dirty",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "When attaching a program to sockmap we need to check map type\nis correct.\n\nFixes: 174a79ff9515 (\"bpf: sockmap with sk redirect support\")\nSigned-off-by: John Fastabend <john.fastabend@gmail.com>\n---\n kernel/bpf/sockmap.c                               |    3 ++\n tools/testing/selftests/bpf/sockmap_verdict_prog.c |    7 +++++\n tools/testing/selftests/bpf/test_maps.c            |   27 +++++++++++++++++---\n 3 files changed, 33 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c\nindex 266011c8..38bf4e4 100644\n--- a/kernel/bpf/sockmap.c\n+++ b/kernel/bpf/sockmap.c\n@@ -794,6 +794,9 @@ int sock_map_attach_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type)\n \tstruct bpf_stab *stab = container_of(map, struct bpf_stab, map);\n \tstruct bpf_prog *orig;\n \n+\tif (unlikely(map->map_type != BPF_MAP_TYPE_SOCKMAP))\n+\t\treturn -EINVAL;\n+\n \tswitch (type) {\n \tcase BPF_SK_SKB_STREAM_PARSER:\n \t\torig = xchg(&stab->bpf_parse, prog);\ndiff --git a/tools/testing/selftests/bpf/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/sockmap_verdict_prog.c\nindex dada207..9b99bd1 100644\n--- a/tools/testing/selftests/bpf/sockmap_verdict_prog.c\n+++ b/tools/testing/selftests/bpf/sockmap_verdict_prog.c\n@@ -26,6 +26,13 @@ struct bpf_map_def SEC(\"maps\") sock_map_tx = {\n \t.max_entries = 20,\n };\n \n+struct bpf_map_def SEC(\"maps\") sock_map_break = {\n+\t.type = BPF_MAP_TYPE_ARRAY,\n+\t.key_size = sizeof(int),\n+\t.value_size = sizeof(int),\n+\t.max_entries = 20,\n+};\n+\n SEC(\"sk_skb2\")\n int bpf_prog2(struct __sk_buff *skb)\n {\ndiff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c\nindex 0a7f457..0c4b56d 100644\n--- a/tools/testing/selftests/bpf/test_maps.c\n+++ b/tools/testing/selftests/bpf/test_maps.c\n@@ -463,12 +463,12 @@ static void test_devmap(int task, void *data)\n #define SOCKMAP_VERDICT_PROG \"./sockmap_verdict_prog.o\"\n static void test_sockmap(int task, void *data)\n {\n+\tint one = 1, map_fd_rx, map_fd_tx, map_fd_break, s, sc, rc;\n+\tstruct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_break;\n \tint ports[] = {50200, 50201, 50202, 50204};\n \tint err, i, fd, sfd[6] = {0xdeadbeef};\n \tu8 buf[20] = {0x0, 0x5, 0x3, 0x2, 0x1, 0x0};\n-\tint one = 1, map_fd_rx, map_fd_tx, s, sc, rc;\n \tint parse_prog, verdict_prog;\n-\tstruct bpf_map *bpf_map_rx, *bpf_map_tx;\n \tstruct sockaddr_in addr;\n \tstruct bpf_object *obj;\n \tstruct timeval to;\n@@ -609,17 +609,36 @@ static void test_sockmap(int task, void *data)\n \t\tgoto out_sockmap;\n \t}\n \n+\tbpf_map_break = bpf_object__find_map_by_name(obj, \"sock_map_break\");\n+\tif (IS_ERR(bpf_map_break)) {\n+\t\tprintf(\"Failed to load map tx from verdict prog\\n\");\n+\t\tgoto out_sockmap;\n+\t}\n+\n+\tmap_fd_break = bpf_map__fd(bpf_map_break);\n+\tif (map_fd_break < 0) {\n+\t\tprintf(\"Failed to get map tx fd\\n\");\n+\t\tgoto out_sockmap;\n+\t}\n+\n+\terr = bpf_prog_attach(parse_prog, map_fd_break,\n+\t\t\t      BPF_SK_SKB_STREAM_PARSER, 0);\n+\tif (!err) {\n+\t\tprintf(\"Allowed attaching SK_SKB program to invalid map\\n\");\n+\t\tgoto out_sockmap;\n+\t}\n+\n \terr = bpf_prog_attach(parse_prog, map_fd_rx,\n \t\t      BPF_SK_SKB_STREAM_PARSER, 0);\n \tif (err) {\n-\t\tprintf(\"Failed bpf prog attach\\n\");\n+\t\tprintf(\"Failed stream parser bpf prog attach\\n\");\n \t\tgoto out_sockmap;\n \t}\n \n \terr = bpf_prog_attach(verdict_prog, map_fd_rx,\n \t\t\t      BPF_SK_SKB_STREAM_VERDICT, 0);\n \tif (err) {\n-\t\tprintf(\"Failed bpf prog attach\\n\");\n+\t\tprintf(\"Failed stream verdict bpf prog attach\\n\");\n \t\tgoto out_sockmap;\n \t}\n \n",
    "prefixes": [
        "net-next",
        "6/9"
    ]
}