Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/524092/?format=api
{ "id": 524092, "url": "http://patchwork.ozlabs.org/api/patches/524092/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1443578287-7847-3-git-send-email-andrew.donnellan@au1.ibm.com/", "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": "<1443578287-7847-3-git-send-email-andrew.donnellan@au1.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1443578287-7847-3-git-send-email-andrew.donnellan@au1.ibm.com/", "date": "2015-09-30T01:58:07", "name": "[3/3] cxl: fix leak of ctx->mapping when releasing kernel API contexts", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "29775c516295cdb9f7a796a3e39637f53c6a8bab", "submitter": { "id": 66955, "url": "http://patchwork.ozlabs.org/api/people/66955/?format=api", "name": "Andrew Donnellan", "email": "andrew.donnellan@au1.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1443578287-7847-3-git-send-email-andrew.donnellan@au1.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/524092/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/524092/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", "linuxppc-dev@ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 1DF96140789\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Sep 2015 12:02:46 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 02A261A0730\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Sep 2015 12:02:46 +1000 (AEST)", "from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id AA7431A0629\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 30 Sep 2015 11:59:06 +1000 (AEST)", "by ozlabs.org (Postfix)\n\tid 9850A140778; Wed, 30 Sep 2015 11:59:06 +1000 (AEST)", "from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142])\n\t(using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 80B0114029C\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 30 Sep 2015 11:59:06 +1000 (AEST)", "from /spool/local\n\tby e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@ozlabs.org> from <andrew.donnellan@au1.ibm.com>;\n\tWed, 30 Sep 2015 11:59:05 +1000", "from d23dlp02.au.ibm.com (202.81.31.213)\n\tby e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tWed, 30 Sep 2015 11:59:04 +1000", "from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219])\n\tby d23dlp02.au.ibm.com (Postfix) with ESMTP id B37E72BB004D\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 30 Sep 2015 11:59:03 +1000 (EST)", "from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96])\n\tby d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tt8U1wpKJ39256100\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 30 Sep 2015 11:58:59 +1000", "from d23av01.au.ibm.com (localhost [127.0.0.1])\n\tby d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tt8U1wVlf032180\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 30 Sep 2015 11:58:31 +1000", "from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14])\n\tby d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tt8U1wVZx031704; Wed, 30 Sep 2015 11:58:31 +1000", "from ajd.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114])\n\tby ozlabs.au.ibm.com (Postfix) with ESMTP id A36DDA028C;\n\tWed, 30 Sep 2015 11:58:06 +1000 (AEST)" ], "X-Helo": "d23dlp02.au.ibm.com", "X-MailFrom": "andrew.donnellan@au1.ibm.com", "X-RcptTo": "linuxppc-dev@ozlabs.org", "From": "Andrew Donnellan <andrew.donnellan@au1.ibm.com>", "To": "linuxppc-dev@ozlabs.org", "Subject": "[PATCH 3/3] cxl: fix leak of ctx->mapping when releasing kernel API\n\tcontexts", "Date": "Wed, 30 Sep 2015 11:58:07 +1000", "Message-Id": "<1443578287-7847-3-git-send-email-andrew.donnellan@au1.ibm.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1443578287-7847-1-git-send-email-andrew.donnellan@au1.ibm.com>", "References": "<1443578287-7847-1-git-send-email-andrew.donnellan@au1.ibm.com>", "X-TM-AS-MML": "disable", "X-Content-Scanned": "Fidelis XPS MAILER", "x-cbid": "15093001-0033-0000-0000-00000230751C", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.20", "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": "mikey@neuling.org, mrochs@linux.vnet.ibm.com, imunsie@au1.ibm.com,\n\tvaibhav@linux.vnet.ibm.com", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "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": "When a context is created via the kernel API, ctx->mapping is allocated\nwithin the kernel and thus needs to be freed when the context is freed.\nreclaim_ctx() attempts to do this for contexts with the ctx->kernelapi flag\nset, but afu_release() (which can be called from the kernel API through\ncxl_fd_release()) sets ctx->mapping to NULL before calling\ncxl_context_free() to free the context.\n\nAdd a check to afu_release() so that the mappings in contexts created via\nthe kernel API are left alone so reclaim_ctx() can free them.\n\nReported-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>\nFixes: 6f7f0b3df6d4 (\"cxl: Add AFU virtual PHB and kernel API\")\nSigned-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>\n---\n drivers/misc/cxl/file.c | 13 ++++++++++---\n 1 file changed, 10 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c\nindex a30bf28..fcda6b0 100644\n--- a/drivers/misc/cxl/file.c\n+++ b/drivers/misc/cxl/file.c\n@@ -120,9 +120,16 @@ int afu_release(struct inode *inode, struct file *file)\n \t\t __func__, ctx->pe);\n \tcxl_context_detach(ctx);\n \n-\tmutex_lock(&ctx->mapping_lock);\n-\tctx->mapping = NULL;\n-\tmutex_unlock(&ctx->mapping_lock);\n+\n+\t/* \n+\t * Delete the context's mapping pointer, unless it's created by the\n+\t * kernel API, in which case leave it so it can be freed by reclaim_ctx()\n+\t */\n+\tif (!ctx->kernelapi) {\n+\t\tmutex_lock(&ctx->mapping_lock);\n+\t\tctx->mapping = NULL;\n+\t\tmutex_unlock(&ctx->mapping_lock);\n+\t}\n \n \tput_device(&ctx->afu->dev);\n \n", "prefixes": [ "3/3" ] }