get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1191977,
    "url": "http://patchwork.ozlabs.org/api/patches/1191977/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20191108130123.6839-39-linux@rasmusvillemoes.dk/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20191108130123.6839-39-linux@rasmusvillemoes.dk>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20191108130123.6839-39-linux@rasmusvillemoes.dk/",
    "date": "2019-11-08T13:01:14",
    "name": "[v4,38/47] soc: fsl: qe: refactor cpm_muram_alloc_common to prevent BUG on error path",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "9fe67d67912b5d868de207f59be80fac4d41ca85",
    "submitter": {
        "id": 27394,
        "url": "http://patchwork.ozlabs.org/api/people/27394/?format=api",
        "name": "Rasmus Villemoes",
        "email": "linux@rasmusvillemoes.dk"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20191108130123.6839-39-linux@rasmusvillemoes.dk/mbox/",
    "series": [
        {
            "id": 141654,
            "url": "http://patchwork.ozlabs.org/api/series/141654/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=141654",
            "date": "2019-11-08T13:00:38",
            "name": "QUICC Engine support on ARM and ARM64",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/141654/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1191977/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1191977/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 478kbG1dsZz9sNT\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat,  9 Nov 2019 02:24:42 +1100 (AEDT)",
            "from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 478kbF4lj9zF5Df\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat,  9 Nov 2019 02:24:41 +1100 (AEDT)",
            "from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 478gQz3jqrzF6tB\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat,  9 Nov 2019 00:02:19 +1100 (AEDT)",
            "by mail-lj1-x241.google.com with SMTP id t5so6157848ljk.0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 08 Nov 2019 05:02:19 -0800 (PST)",
            "from prevas-ravi.prevas.se ([81.216.59.226])\n\tby smtp.gmail.com with ESMTPSA id\n\td28sm2454725lfn.33.2019.11.08.05.02.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 08 Nov 2019 05:02:15 -0800 (PST)"
        ],
        "Authentication-Results": [
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=rasmusvillemoes.dk",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk\n\theader.b=\"ghv2Fitd\"; dkim-atps=neutral",
            "lists.ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::241;\n\thelo=mail-lj1-x241.google.com; envelope-from=linux@rasmusvillemoes.dk;\n\treceiver=<UNKNOWN>)",
            "lists.ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=rasmusvillemoes.dk",
            "lists.ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk\n\theader.b=\"ghv2Fitd\"; dkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=rasmusvillemoes.dk; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=VA9GbHfmKtODbCm0QoKaPVG8lLjwOAvz4Dj0Clq1FXQ=;\n\tb=ghv2Fitdi+5CpOHryA/uKu7tvP1mIrcR7EQ6Boj2/RIU2+jYku8qiRim9NlU1bMI9t\n\tjibRIInuK9ovNCl4B0NJGdUU3ySNR4YSeno58I0x0vbag1VAvxIje3y/7NhG3ERCFGnp\n\tox4wBxv0EYbYTQMQ1MAeNcI4UNMBZJ7Jq/bJ4=",
        "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:mime-version:content-transfer-encoding;\n\tbh=VA9GbHfmKtODbCm0QoKaPVG8lLjwOAvz4Dj0Clq1FXQ=;\n\tb=gIoYvcCPJ7NWXNceJ3Ad9TWxEeLi0C/IjosYY434VLhhBklcKXIk0WLgn4IezVrGVJ\n\t8hR2k1QoL6aZaDiVfOSRsVXs0bjwazCLbrp93iuCX04iNcHYlK1D3cJGzA0yviizBKi7\n\tUhyAXgNEvo5Us1GnlaSRyDiExisOQlNdtHSJJCDSNm89rZsKAGl2/0bL619Ju3k2xOA2\n\tZBzsHuhB3qHfjlott38ajTwQj1ruO9EQQbouaEhLBL52q25WnBHjYA6h66uDGpBpomCB\n\tqULYL/qmTATd9sTFi3G8X7vYznErr2BggZ6G4JHwSl5ZQpiEyMm1q+IW1P8Sbaf5Bl99\n\tnnWQ==",
        "X-Gm-Message-State": "APjAAAUgfu5N0t7G3VUbI1i1NvnNO6xheqyKVo+ShJlQ883AnLNAFOMM\n\t2D7CxufOvuCRvLqJkue0tfPuVw==",
        "X-Google-Smtp-Source": "APXvYqyoMqCjl5BXnYcK2ml6PASxOb4ksaKGHBnk0QjLBR1ADRWrjlHrHrSVaMf4Baj7cALCi+3dFg==",
        "X-Received": "by 2002:a2e:9119:: with SMTP id m25mr6927156ljg.24.1573218135990;\n\tFri, 08 Nov 2019 05:02:15 -0800 (PST)",
        "From": "Rasmus Villemoes <linux@rasmusvillemoes.dk>",
        "To": "Qiang Zhao <qiang.zhao@nxp.com>, Li Yang <leoyang.li@nxp.com>,\n\tChristophe Leroy <christophe.leroy@c-s.fr>",
        "Subject": "[PATCH v4 38/47] soc: fsl: qe: refactor cpm_muram_alloc_common to\n\tprevent BUG on error path",
        "Date": "Fri,  8 Nov 2019 14:01:14 +0100",
        "Message-Id": "<20191108130123.6839-39-linux@rasmusvillemoes.dk>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191108130123.6839-1-linux@rasmusvillemoes.dk>",
        "References": "<20191108130123.6839-1-linux@rasmusvillemoes.dk>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "Scott Wood <oss@buserror.net>,\n\tRasmus Villemoes <linux@rasmusvillemoes.dk>, \n\tlinuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org",
        "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"
    },
    "content": "If the kmalloc() fails, we try to undo the gen_pool allocation we've\njust done. Unfortunately, start has already been modified to subtract\nthe GENPOOL_OFFSET bias, so we're freeing something that very likely\ndoesn't exist in the gen_pool, meaning we hit the\n\n kernel BUG at lib/genalloc.c:399!\n Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM\n ...\n [<803fd0e8>] (gen_pool_free) from [<80426bc8>] (cpm_muram_alloc_common+0xb0/0xc8)\n [<80426bc8>] (cpm_muram_alloc_common) from [<80426c28>] (cpm_muram_alloc+0x48/0x80)\n [<80426c28>] (cpm_muram_alloc) from [<80428214>] (ucc_slow_init+0x110/0x4f0)\n [<80428214>] (ucc_slow_init) from [<8044a718>] (qe_uart_request_port+0x3c/0x1d8)\n\n(this was tested by just injecting a random failure by adding\n\"|| (get_random_int()&7) == 0\" to the \"if (!entry)\" condition).\n\nRefactor the code so we do the kmalloc() first, meaning that's the\nthing that needs undoing in case gen_pool_alloc_algo() then\nfails. This allows a later cleanup to move the locking from the\ncallers into the _common function, keeping the kmalloc() out of the\ncritical region and then, hopefully (if all the muram_alloc callers\nallow) change it to a GFP_KERNEL allocation.\n\nSigned-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>\n---\n drivers/soc/fsl/qe/qe_common.c | 16 +++++++---------\n 1 file changed, 7 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c\nindex feb33ec1c3d6..bc9b436684df 100644\n--- a/drivers/soc/fsl/qe/qe_common.c\n+++ b/drivers/soc/fsl/qe/qe_common.c\n@@ -119,23 +119,21 @@ static s32 cpm_muram_alloc_common(unsigned long size,\n \tstruct muram_block *entry;\n \ts32 start;\n \n+\tentry = kmalloc(sizeof(*entry), GFP_ATOMIC);\n+\tif (!entry)\n+\t\treturn -ENOMEM;\n \tstart = gen_pool_alloc_algo(muram_pool, size, algo, data);\n-\tif (!start)\n-\t\tgoto out2;\n+\tif (!start) {\n+\t\tkfree(entry);\n+\t\treturn -ENOMEM;\n+\t}\n \tstart = start - GENPOOL_OFFSET;\n \tmemset_io(cpm_muram_addr(start), 0, size);\n-\tentry = kmalloc(sizeof(*entry), GFP_ATOMIC);\n-\tif (!entry)\n-\t\tgoto out1;\n \tentry->start = start;\n \tentry->size = size;\n \tlist_add(&entry->head, &muram_block_list);\n \n \treturn start;\n-out1:\n-\tgen_pool_free(muram_pool, start, size);\n-out2:\n-\treturn -ENOMEM;\n }\n \n /*\n",
    "prefixes": [
        "v4",
        "38/47"
    ]
}