Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220916/?format=api
{ "id": 2220916, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220916/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/e37025db2008cde5ccc4f88fad076d96555dbcf4.1775648406.git.ritesh.list@gmail.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/1.1/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/" }, "msgid": "<e37025db2008cde5ccc4f88fad076d96555dbcf4.1775648406.git.ritesh.list@gmail.com>", "date": "2026-04-08T12:01:34", "name": "[RFC,v2,04/10] pseries/papr-hvpipe: Fix the usage of copy_to_user()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5a10e2e9f9913d5c664112ef2af5f4e447eed61a", "submitter": { "id": 79126, "url": "http://patchwork.ozlabs.org/api/1.1/people/79126/?format=api", "name": "Ritesh Harjani (IBM)", "email": "ritesh.list@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/e37025db2008cde5ccc4f88fad076d96555dbcf4.1775648406.git.ritesh.list@gmail.com/mbox/", "series": [ { "id": 499129, "url": "http://patchwork.ozlabs.org/api/1.1/series/499129/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=499129", "date": "2026-04-08T12:01:30", "name": "pseries/papr-hvpipe: Fix deadlock, races and misc cleanups", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/499129/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220916/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220916/checks/", "tags": {}, "headers": { "Return-Path": "\n <linuxppc-dev+bounces-19500-incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Fs2IqKGX;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19500-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)", "lists.ozlabs.org;\n arc=none smtp.remote-ip=\"2607:f8b0:4864:20::431\"", "lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Fs2IqKGX;\n\tdkim-atps=neutral", "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com\n (client-ip=2607:f8b0:4864:20::431; helo=mail-pf1-x431.google.com;\n envelope-from=ritesh.list@gmail.com; receiver=lists.ozlabs.org)" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frMBT38ZRz1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 22:02:25 +1000 (AEST)", "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4frMBF3fL3z2yfl;\n\tWed, 08 Apr 2026 22:02:13 +1000 (AEST)", "from mail-pf1-x431.google.com (mail-pf1-x431.google.com\n [IPv6:2607:f8b0:4864:20::431])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4frMBD5mHJz2xc8\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 08 Apr 2026 22:02:12 +1000 (AEST)", "by mail-pf1-x431.google.com with SMTP id\n d2e1a72fcca58-824c9da9928so5191449b3a.3\n for <linuxppc-dev@lists.ozlabs.org>;\n Wed, 08 Apr 2026 05:02:12 -0700 (PDT)", "from Mac.localdomain ([49.205.216.49])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82cf9b3e169sm21209322b3a.18.2026.04.08.05.02.06\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Wed, 08 Apr 2026 05:02:09 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775649733;\n\tcv=none;\n b=XDYIXd9gshEmt4ppVWG9R+vPZY0UQZ0q/77DQ/ubGphi7yCyRaSbnq/gdF4pDlnBDgP/1B9OfGu5wst4+lchya8PnQmKlOkyoY4lAxFEArd95pKlauSOqrUkRQvdS4LNf0cnzZ5ke0zPyI/NzXw4fsLP755m78YG0uLOCcv+gcXN+hihon7epVnptIaxiwIImwje5GncIKokq3UJuqvd2GO6rTjnvtsq/FmToREORPj9xy6ruu/blMSNv4NUBBh9yWk0kxuabZbs4mOLHkSZuM5tESj17k4J4Hjc9JrKy3Qj53igFsiamkl63pB24mL0zxfJfXy5wsKLWKKhIlS+BQ==", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775649733; c=relaxed/relaxed;\n\tbh=mu3P1VfNo0DCayRCdHHojPZFKAzDzWNLwEKMHMNVDaE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=AZ5bkpOomEAyo1GMG0+w/YsPHuFQ4e7J/GjG/HyFYKXn5GhOxhSnkpyYyujV1t83c8fX8ujqunJIxNMklVot/UJ/N4e00WX8CY940E/PWPJWrQA4MFTHIhsD9p7KXgjQ7f77JfEUybVQIZz64HNU+wZS+sJQblfMGSu/Kftwxs6OcJo4uwFQ+EQWbFpoGzRrQFcerccCnENdROUCxzLHsfa0ZbcY1N+Jbm4l9NnwmciLuCrIsbHcgY7XSmGHx35T58A8FH0Nfj2Cg5W3poYMdbNiCR6zcla0AgeCibTuRLpekMkpFzDsLvQcAadH+XsNll+4D1DERl0iDBVhIYD0Wg==", "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Fs2IqKGX; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::431; helo=mail-pf1-x431.google.com;\n envelope-from=ritesh.list@gmail.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=gmail.com", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775649730; x=1776254530;\n darn=lists.ozlabs.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=mu3P1VfNo0DCayRCdHHojPZFKAzDzWNLwEKMHMNVDaE=;\n b=Fs2IqKGXIZRk7kpu9E4Z2e3mZ3mhBwn4vqsyTRgHHnvbvVWqSdS1uVLctWuADqVgXP\n c+jeqANc190sSgYqmeC3jtZd7bXxTzPN/TyVZCiVdM1p/lsocIhGyKeuOeIIdHSVMRjs\n CyA9ba6cd/3Po4EEvF/BAl5E9DXyYm98nCL+nJmpddJoCR89OYwcHf5ifieJ/h3r3526\n TAUb4E5truSzKGy2+J5lad89H+H6nYbdrIe6QY4HFFZl6L6wxEXEQh5NiFk36IAMMVkJ\n gvkIVU2G0CelgXVr5Fh0svQ3t7/3kGKaBw75uOHSO6EB3ZNhmQRRETrPqWAJ/A3TvQ1O\n yy+w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775649730; x=1776254530;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=mu3P1VfNo0DCayRCdHHojPZFKAzDzWNLwEKMHMNVDaE=;\n b=UH4JeD9ljQSts8eL8d+y1aQneUP/MXVMLQlW/u4QWJo+LFtF/YwPer1ILmQrHyCNg8\n prTb/YHV+7xz9LiDapnYnKoQtRBMKsuSjCu7RAQPHYodZsFq4ZFTLmTSf7cmMOlcXC36\n 8lQKrI2+XCqX2Lk1kb4qUaM47x8czi1jX9zTFvfotzkdPa0d2rYILvdpU1zN7B9yModM\n bYpRQ+mnYfGja3jS89kpGvQeJDaRLsf4BqCsNZvQ4jRoEI3mcM6L/dwf57UzQ6fb+rMK\n kpHU2Z9OspyvzFN1ej8CZls2LiVtRj/q4lmaPAuZL/+a8plznOQy5O+lAnDISeRweGno\n 9Aww==", "X-Gm-Message-State": "AOJu0YxJamXS4AcEBCy8Si12lb8Nflwp2FmJTnSZaQBrw8VAcx9I9x+T\n\t981JuxoGE7QjDT+vDDJUkmgIbePMXOO0snhhZ1xB2v5eI55nov8qOE0A", "X-Gm-Gg": "AeBDieut++R/2nuIuaT3AHaodv3SK46oTEsGcr6DF5WEFsUK4xWbWAiJBkfYI+lcVLr\n\tMHjTQ8FBW2QFDWlPZPrsD7nNWK3+/U5N2rnQMrqFu/Ap3DKj9V8+SzFG+OwCDbujskrsGSu96PM\n\tpI3tpepFS8LduI5b892+Ry9fU5SJVqvAKNYE1Sny4Fq/7ilHmp8HMFM8ZejmP8tJvTe5WDRUOpe\n\tudMb3AyxwqP/X9t5Amy8SZuJnFrp5wajYv7b+OqAQTLEq/2nz+sSUswJQLkPx+ulsFurseM7Hgt\n\t7dYC+DvZRXtqyOnpwRtogFY42UmlpzRcNVyDFywp5EL5y33/+JFV6hysWNL3qNLVLO6OxZ2uYSe\n\tJEUcROaPGpsSwbmEvHdfrys9T2tyAJGq6X0IN50MIjFMnteRkTB7bpDNWIm4EYy2ZPj53kJ3nuG\n\toUMA==", "X-Received": "by 2002:a05:6a00:2e93:b0:827:4343:4c1 with SMTP id\n d2e1a72fcca58-82d0db32d62mr19867111b3a.29.1775649730179;\n Wed, 08 Apr 2026 05:02:10 -0700 (PDT)", "From": "\"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>", "To": "linuxppc-dev@lists.ozlabs.org,\n\tHaren Myneni <haren@linux.ibm.com>", "Cc": "Madhavan Srinivasan <maddy@linux.ibm.com>,\n\tChristophe Leroy <chleroy@kernel.org>,\n\tVenkat Rao Bagalkote <venkat88@linux.ibm.com>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\tlinux-kernel@vger.kernel.org,\n\t\"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>", "Subject": "[RFC v2 04/10] pseries/papr-hvpipe: Fix the usage of copy_to_user()", "Date": "Wed, 8 Apr 2026 17:31:34 +0530", "Message-ID": "\n <e37025db2008cde5ccc4f88fad076d96555dbcf4.1775648406.git.ritesh.list@gmail.com>", "X-Mailer": "git-send-email 2.50.1", "In-Reply-To": "<cover.1775648406.git.ritesh.list@gmail.com>", "References": "<cover.1775648406.git.ritesh.list@gmail.com>", "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org", "List-Id": "<linuxppc-dev.lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>", "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n <https://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>", "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>", "Precedence": "list", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-0.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1 OzLabs 8", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org" }, "content": "copy_to_user() return bytes_not_copied to the user buffer. If there was\nan error writing bytes into the user buffer, i.e. if copy_to_user\nreturns a non-zero value, then we simply return -EFAULT from the\n->read() call.\n\nAlso let's make sure we clear the hvpipe_status flag, if we have\nconsumed the hvpipe msg by making the rtas call. ret = -EFAULT means\ncopy_to_user has failed but that still means that the msg was read from\nthe hvpipe, hence for both cases, success & -EFAULT, we should clear the\nHVPIPE_MSG_AVAILABLE flag in hvpipe_status.\n\nSigned-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>\n---\n arch/powerpc/platforms/pseries/papr-hvpipe.c | 23 ++++++++++++--------\n 1 file changed, 14 insertions(+), 9 deletions(-)", "diff": "diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c\nindex 402781299497..5c773a6f0efc 100644\n--- a/arch/powerpc/platforms/pseries/papr-hvpipe.c\n+++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c\n@@ -206,10 +206,11 @@ static int hvpipe_rtas_recv_msg(char __user *buf, int size)\n \t\t\t\t\tbytes_written, size);\n \t\t\t\tbytes_written = size;\n \t\t\t}\n-\t\t\tret = copy_to_user(buf,\n+\t\t\tif (copy_to_user(buf,\n \t\t\t\t\trtas_work_area_raw_buf(work_area),\n-\t\t\t\t\tbytes_written);\n-\t\t\tif (!ret)\n+\t\t\t\t\tbytes_written))\n+\t\t\t\tret = -EFAULT;\n+\t\t\telse\n \t\t\t\tret = bytes_written;\n \t\t}\n \t} else {\n@@ -328,7 +329,7 @@ static ssize_t papr_hvpipe_handle_read(struct file *file,\n \n \tstruct hvpipe_source_info *src_info = file->private_data;\n \tstruct papr_hvpipe_hdr hdr = {};\n-\tlong ret;\n+\tssize_t ret = 0;\n \n \t/*\n \t * Return -ENXIO during migration\n@@ -376,7 +377,7 @@ static ssize_t papr_hvpipe_handle_read(struct file *file,\n \n \tret = copy_to_user(buf, &hdr, HVPIPE_HDR_LEN);\n \tif (ret)\n-\t\treturn ret;\n+\t\treturn -EFAULT;\n \n \t/*\n \t * Message event has payload, so get the payload with\n@@ -385,19 +386,23 @@ static ssize_t papr_hvpipe_handle_read(struct file *file,\n \tif (hdr.flags & HVPIPE_MSG_AVAILABLE) {\n \t\tret = hvpipe_rtas_recv_msg(buf + HVPIPE_HDR_LEN,\n \t\t\t\tsize - HVPIPE_HDR_LEN);\n-\t\tif (ret > 0) {\n+\t\t/*\n+\t\t * Always clear MSG_AVAILABLE once the RTAS call has drained\n+\t\t * the message, regardless of whether copy_to_user succeeded.\n+\t\t */\n+\t\tif (ret > 0 || ret == -EFAULT)\n \t\t\tsrc_info->hvpipe_status &= ~HVPIPE_MSG_AVAILABLE;\n-\t\t\tret += HVPIPE_HDR_LEN;\n-\t\t}\n \t} else if (hdr.flags & HVPIPE_LOST_CONNECTION) {\n \t\t/*\n \t\t * Hypervisor is closing the pipe for the specific\n \t\t * source. So notify user space.\n \t\t */\n \t\tsrc_info->hvpipe_status &= ~HVPIPE_LOST_CONNECTION;\n-\t\tret = HVPIPE_HDR_LEN;\n \t}\n \n+\tif (ret >= 0)\n+\t\tret += HVPIPE_HDR_LEN;\n+\n \treturn ret;\n }\n \n", "prefixes": [ "RFC", "v2", "04/10" ] }