From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 440413033E8 for ; Fri, 1 May 2026 04:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608741; cv=none; b=e4dKvXSTXBHyg2l62/wnE+VYRiWy4bHh6Er5yh+3Nrh4rzfVBL1l3BgJh5JLiVfNiqa6kxBZlBQUr/Ea4sz5bcutNYUcoAxmeQN+lkhDNHx70mbHwnGqHO9lme2gNXkfW/gdZm+oX1ZeCO4HSwTsjiRgNFhYiT/aCgR8JVUMIZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608741; c=relaxed/simple; bh=9NbnFzTEGh6+lE1PwksEW7af7i8jzYb/dCKoYyURmxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nRv7cuOxtReXa1cYNqCiDKdwO0pvjh+Vd8IM6c5fSN6wXwTRvqYWuYVZ3LV7sx7xrgGQuV6KstRPNehDgBUqY6ksM0R4hKwjCBLyL9u9F0GjpjM9agvPJUGN7bLvBMLVmKwOzZnSnIiasxhxbQn8VLNtgMb87+rwInoxfc7pyE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WflBnlVV; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WflBnlVV" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-827270d50d4so1556293b3a.3 for ; Thu, 30 Apr 2026 21:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608740; x=1778213540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PYNm6J9AhUQ6HT8V6B6W7Iuh7E+aasxrExqJ2exyz7U=; b=WflBnlVVLpYKdqZ5+gvI7bTslgdtAUNJ8HJNO541GdBxHGlR1YHd8uBzDm1zAf4oZV nkxZRbPocjasqAZWQ94rZg1CKbKbaVGjKdmA23rmemQIekV6OBdXP+W1WjEIl0LR9eHF 2BjVGuLtvP/CuA034+o7zFdRfHFs9PeJBJMyMHjjninSBID1QP6bjOIM9jRO0IHwn7Ix hmnSJlbMcC4Th5v7+BJiy9cgmAvfClMRQ4LtWeTlf8nUyz2DrHM6Cwr+l4BtgOt7epCt SFp5s916/tW9oSYDO3cxIotZFjU+Z9b4yxed38Nz10xDjsGHbup9lwNWrNyXjNe30uL+ ai6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608740; x=1778213540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PYNm6J9AhUQ6HT8V6B6W7Iuh7E+aasxrExqJ2exyz7U=; b=EZVonSMLARB2WnhZRgPq5cn+nSg7TDb+pJcIa+RwPcHWjWq/wIxxw/m0Il7bNLLh5u 9nqP7HPem5GjvfRaLukxFLPnEBN94tYl1ub8BflVmwPM6KR1TkU1dnlwNk1b6kPb+OhS AxFJ8R5emV8oW5dd+If7Sc8qSNUNEUkVd7ZYsd20AMVl5Bw2mCqF3q1W4qk4Ueu1ddSL pNZ3lAz/IT1XnRzjnJroXybMqcc6yngXjf+KZMoeoSbDgHFKvgeaBMa9UGwia17Tscz+ Rn3ckHU4WcVMumBjdfKDNY/CulaNE/XIqUOjEGUifqZAYtSc0cHa+fes90wPL6bY3arB kjZA== X-Forwarded-Encrypted: i=1; AFNElJ9sJjXfaN4XqH3uCs7iNZCnJrZf3DmFTuQoUajjCAPz6Qj5C16M/qdPIPGOC/v4G0gBDa0X5lL3zjR0rtk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4BmHUOQph6cvjHUvyhuk4MR6gCmab0Rd2AK62M/Gn/iNh4GbH LXU/PB/+Q0wq5F3bYU2ZNtNK38O4Nqr6jCnRRMo6iQDyZNiYfH5+z0Nz X-Gm-Gg: AeBDievIkI04+98WzuQNwWeq34Gb/aERzrKmbGGo7DILvXf4pCtqPyPW+CAUaaaplw6 QLC8ZFMe6atT1p+3VXhbNZ+fhuzXRdk2hwG7dxQni7UspLfB0wvoIoIfGtEd5HswarSHo5/sLk/ TFxKf00So7HAAFQrz9z16zxzdOjLSNDCk3em7zRXk1zMfh9xhOLnfZnT5gEmU0nuxslpU3SQp7e yPhw9g/zm8nRnawLRmQzDEFOsXBCxeBSBArDaAI/vJdRp7tSHtu9igffPSnIyU4Si8OVkf3QWAq oThTxYf9SrZnX8Gecdlq8c0bO8M53TvBQzW4cReFvzKUHr1Xi8zpyoTqo4as5A4ULChPDh0xcwM djS97Qb4vufaqt9JIuRx1NQuAun3R7wEfpYbNcTR2Ix0WFLQ2bBr1gbEnlEZmd1R48eLJ5q/q5P ImzxWfNn8+zdHaqO+v2oWP14gLI8JoErT278ty1TnT9gKzaoxpLmh++MOF7P4uF0o= X-Received: by 2002:a05:6a00:1c9e:b0:824:adf4:5a2f with SMTP id d2e1a72fcca58-834fdc5c2admr6357028b3a.43.1777608739583; Thu, 30 Apr 2026 21:12:19 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:18 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" , stable@vger.kernel.org Subject: [PATCH v3 1/9] pseries/papr-hvpipe: Fix race with interrupt handler Date: Fri, 1 May 2026 09:41:40 +0530 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While executing ->ioctl handler or ->release handler, if an interrupt fires on the same cpu, then we can enter into a deadlock. This patch fixes both these handlers to take spin_lock_irq{save|restore} versions of the lock to prevent this deadlock. Cc: stable@vger.kernel.org Fixes: 814ef095f12c9 ("powerpc/pseries: Add papr-hvpipe char driver for HVP= IPE interfaces") Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 14ae480d060a..c41d45e1986d 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -444,13 +444,14 @@ static int papr_hvpipe_handle_release(struct inode *i= node, struct file *file) { struct hvpipe_source_info *src_info; + unsigned long flags; =20 /* * Hold the lock, remove source from src_list, reset the * hvpipe status and release the lock to prevent any race * with message event IRQ. */ - spin_lock(&hvpipe_src_list_lock); + spin_lock_irqsave(&hvpipe_src_list_lock, flags); src_info =3D file->private_data; list_del(&src_info->list); file->private_data =3D NULL; @@ -461,10 +462,10 @@ static int papr_hvpipe_handle_release(struct inode *i= node, */ if (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) { src_info->hvpipe_status =3D 0; - spin_unlock(&hvpipe_src_list_lock); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); hvpipe_rtas_recv_msg(NULL, 0); } else - spin_unlock(&hvpipe_src_list_lock); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); =20 kfree(src_info); return 0; @@ -480,20 +481,21 @@ static const struct file_operations papr_hvpipe_handl= e_ops =3D { static int papr_hvpipe_dev_create_handle(u32 srcID) { struct hvpipe_source_info *src_info __free(kfree) =3D NULL; + unsigned long flags; =20 - spin_lock(&hvpipe_src_list_lock); + spin_lock_irqsave(&hvpipe_src_list_lock, flags); /* * Do not allow more than one process communicates with * each source. */ src_info =3D hvpipe_find_source(srcID); if (src_info) { - spin_unlock(&hvpipe_src_list_lock); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); pr_err("pid(%d) is already using the source(%d)\n", src_info->tsk->pid, srcID); return -EALREADY; } - spin_unlock(&hvpipe_src_list_lock); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); =20 src_info =3D kzalloc_obj(*src_info, GFP_KERNEL_ACCOUNT); if (!src_info) @@ -510,18 +512,18 @@ static int papr_hvpipe_dev_create_handle(u32 srcID) return fdf.err; =20 retain_and_null_ptr(src_info); - spin_lock(&hvpipe_src_list_lock); + spin_lock_irqsave(&hvpipe_src_list_lock, flags); /* * If two processes are executing ioctl() for the same * source ID concurrently, prevent the second process to * acquire FD. */ if (hvpipe_find_source(srcID)) { - spin_unlock(&hvpipe_src_list_lock); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); return -EALREADY; } list_add(&src_info->list, &hvpipe_src_list); - spin_unlock(&hvpipe_src_list_lock); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); return fd_publish(fdf); } =20 --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BD7F30B514 for ; Fri, 1 May 2026 04:12:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608745; cv=none; b=pMn57RbfMesSTeh14rs+FQXgTa/XamzY2xhdDE60kTtnPQTKhrlBQw/gmYVFiTX8mC7sCWmHAjZcSZnhiP9SK24GrYXe6pEJXKWpND+GLjXW/e4hTSpTyQ5r8TTqT+n42dtJAdtS0b6Y+RYVlINuPJuVQfjzmnUX2yn1dg80D+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608745; c=relaxed/simple; bh=yTxnDirvmnH5LGk1im4CZr5o+rO8DwmekAa/5S50bt4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C3aC9NtTB8qBZ/4R5O/kE3PatEcYjd/S96Y2T+A8OjyqChOTQ3Fiuek8BFNdPGNcQATGXmaR7NuajTCWoXDVBxxthQxbULvKxI1BhKfMSEH4I9gAqTHznym5Rf6qQwz3TIyPTasuvA9KnYYMoWV22X/8If2JDo1QAVWRyArqVAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aU4dpX23; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aU4dpX23" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-8296d553142so1110682b3a.3 for ; Thu, 30 Apr 2026 21:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608744; x=1778213544; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t0UuqUvbVXxe7PO3IdsW6Ps33YC23onFgbsbMbzoM7M=; b=aU4dpX232Zx83qBZozzV8NNyNHSHipEWPFQE1bsAYUrugqMIyuhUYGiy0I3awW11xI YSBnMbKrLVGlMeFzROcH4m5w0ZE5CxiJzhrHUMnLThw1vKncxTJHpoT2EgUjUxfXyaUR KCvAB/amIr+XvV6Y7MRdsa4NZZafNtIMb7xU64AJBnme59/vftbgDYboWvISjW3gmk6D AEQDHaIxgvEoSdODa3rPpWjkDPxP3cwob9xNcEF/IBsx2oG/UqEkKFHvrTYAFYJocNkV mdo/k1e/g+xmza4Wj3HI73DyJAEmJ4GO6ngoRlhUH8CUt/zzBENeRo29lRmnlLUnc4Ep Tk7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608744; x=1778213544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=t0UuqUvbVXxe7PO3IdsW6Ps33YC23onFgbsbMbzoM7M=; b=Th5nblHv8ebHjLdGU1svc315j0VQ6Hm/JWfy/BNT4mIjUbKH+Z937LJwY1vo21iSqc Y0NTNG32pSWYgRvhtBVgHZDXRsOAF3vEu4EClhh9OTH6h5icKwtg8GYzYfyiTKuOFwbt 6thghjaZdjj2YtKeB1QJ9Av0Of4EAah0NRO1PHayKjm6JEo9J7WptiHGd4T4x8bDiD0R 5N4AOJvUBTWH6jLkA4+bxQ8FDowD5dWTmVrd8pCZzy6CiwpI05GJZNvoSVt74X4ey4zu iP2qHyuglrWlL0SmIiD+15nGhCu2JTabI4Vbomnpnual7462QwMJJ2F1V5ld5JZYU/7g s6Yg== X-Forwarded-Encrypted: i=1; AFNElJ8H8NWOnbdrPUCjXPRnvR5ld8qBbw3RIUkm4t0M6J5UBen7NV8apdsKao7inEXSF56mvnTJqcSm03d/Gbw=@vger.kernel.org X-Gm-Message-State: AOJu0YwBeETNzB51tpmE8KTNmC17eNkIWTl+2qL3+Aj3qx19TECdKpdg qHZpWCZ0L7fc3G0jyQIaAf913UxHA8kXFozrU4UAU7WsQuAwZW/JCCCU X-Gm-Gg: AeBDietiGJ8Wz3O14I5QnKFW6ksUH7tqRcVEAYriLQD2u/OVIdo0ubjAGNbbG7vk+D6 R/c4UiEfDVDcVA8UaLnBKcoo+RG4h9IYm2YiiYNHxmhVz3qdN+OusLP6jg1VmtFkDDACbfthWfZ co8yR9/RdgWudTpVmSKhiubGQd2losYA1XEuyIu8n3RdlP8OAxDBA0W6/0I6mK9/rOxNwstqRJR Mfp6QNVpJ2nN9Zd5mvchns+er632+gTLGFZOXLbbJrKi3F6I+0nx+aE2t4Ut/ZZFqA9d4XNjVLu sEnzjFkCg+rmzlB3j0juedHWHWBUC85x6/ty4zLc5g13z43uy36URksGOSWcOCFgHfYPZp/S8fB CAv2pEo7nLVkzCPWcHhTNwfutjsCEO1SGsnsAH4xsM0wlBDQhTHYBuo48EW1jMvLBG3/dY5VNde 0OT/Bk0z73bni46B9LWrDT9SWpPt/jdp4lXn31tJz9zwXFsb0siMQGYx80gOZJVaw= X-Received: by 2002:a05:6a00:181f:b0:82c:6b23:6d10 with SMTP id d2e1a72fcca58-834fdb58c54mr6377026b3a.3.1777608743787; Thu, 30 Apr 2026 21:12:23 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:22 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" , stable@vger.kernel.org Subject: [PATCH v3 2/9] pseries/papr-hvpipe: Prevent kernel stack memory leak to userspace Date: Fri, 1 May 2026 09:41:41 +0530 Message-ID: <7bfe03b65a282c856ed8182d1871bb973c0b78f2.1777606826.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The hdr variable is allocated on the stack and only hdr.version and hdr.flags are initialized explicitly. Because the struct papr_hvpipe_hdr contains reserved padding bytes (reserved[3] and reserved2[40]), these could leak the uninitialized bytes to userspace after copy_to_user(). This patch fixes that by initializing the whole struct to 0. Cc: stable@vger.kernel.org Fixes: cebdb522fd3ed ("powerpc/pseries: Receive payload with ibm,receive-hv= pipe-msg RTAS") Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index c41d45e1986d..3392874ebdf6 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -327,7 +327,7 @@ static ssize_t papr_hvpipe_handle_read(struct file *fil= e, { =20 struct hvpipe_source_info *src_info =3D file->private_data; - struct papr_hvpipe_hdr hdr; + struct papr_hvpipe_hdr hdr =3D {}; long ret; =20 /* --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1351330DD30 for ; Fri, 1 May 2026 04:12:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608750; cv=none; b=isoWNB+QXhR4yO2wbQqDYS3R2QnmmtaQiNevpPkMJfOjmi3scZuL5KK7Lef+Ukmtnrh3BrDQtE19+iKY/qh6Cfh8zV+CXKJsVal3bvyoLPmou1lDoWsmumQ3yna1Yl6/nMV2ZVpfsJs96fXi7seNomBD90Q2ctju1PjQFz17FHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608750; c=relaxed/simple; bh=Z2tXO/TODik6ZuM5fgaciL/nr8ovAug6a5249/dhZ1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gw7rF/YPMQlc/pLmKHbsN17HTyoPLiN5DvTKQb8tmJiyQoKROmeIOP5zGZSAZYCRRVTTvskgfPXNlNMqfQFY1U5TQBhfqC3mnwNXAj3MPXy+jTOXlazKvN6CNr0vd+xgWUJgi5ZTt9Qul9QjLWnm/95ZsL5L1yMX3BigzGPc884= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EvSfAXZo; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EvSfAXZo" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-35d9f68d011so1027664a91.2 for ; Thu, 30 Apr 2026 21:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608748; x=1778213548; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dF2w3z4/59cYB6Oy2yDdp9rDcfrHGTFcj+1xeJe6XK4=; b=EvSfAXZoRO1VrT3k6sVua0KgFCU8a9D2LK8EtiC5FTVY6C9pGkVvAb50x26xUJqD3D vcdcDKDzpVjjKIkp5sX+VYx9YSvJBJtWL8PUdlqveKa2rc2K/pOnlJ9nWMLYqbfdcfop rcqQUrmb0eBtyM7r0ktBH4uMefHsrNMjb5ecrM4fG0jSuXx1rK1xhkvGsAm4++QiBq/f LlUQQt5jnMntkNJ/OrjlEaTFLupq25YWMDJdQdiSk48v7P/RnOlvkV4GpivWqlVnIHDm 2cAk9/BQ6rX9yv40ffT3GgR69LFKHo0iWrDGLPEe/WYvevgBNWjNlmCjpd0ErMp83BFU pCMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608748; x=1778213548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dF2w3z4/59cYB6Oy2yDdp9rDcfrHGTFcj+1xeJe6XK4=; b=eaS1EejQ9woLWyWGMP7WXcoYKCY56DbL9GFBmsYeGG6lPiZulYHvnqRtw3lpyuF4HX UM1csQJ94dcY8D5zJmMzMr0g81EoLHRtxJjrFta42hpId31pDj+Grm5lkFgkX/LZ6NIl StXYfui30wOR4KHePGcph/07SbrCkqga37ffFy4x9z4AUGNSpV7J7bahQKtLXZQHvljg 6ZuBhRLyulN33FSQGnXJOrfCdGAQyLCXtnlhD++Np0BpFmjf8OWMDQz+AMz3cHoL9Xmr tLNc3ckeLDVawOUxSgK/u4a0eXuMGt+zKDuqshc/idTfzrzXscIED9JQDt4Xc+993Hv3 fYTQ== X-Forwarded-Encrypted: i=1; AFNElJ8H4g5r+ptncppYB67v8M1Fi+sxDxP5QpK+XICN+f0uWPq7jEgo/e8HZgiUrHzD/EqkDi42MRip+ACl3sA=@vger.kernel.org X-Gm-Message-State: AOJu0YwM6hJjlK+thJfG09gvt8ShXSEmAat+1iA4YtQz1APEENtOH89E 8xrPA/MTTepG6DEDYJLUGdbkU1GgbgojRhv0ba0BBcMjI22NEnVcCkrr X-Gm-Gg: AeBDieu1DlNVWtHdzBZFh2Bi8FUNjXmE9lAKJBD3ZbR4pIf+tp8Yo+45Pw5tQcMG5Pq 76oUd4APQ9ThpXRMlGeO6o8CKjSRX9bfO17kiKMnugSlLFVpGHvdW+f//mR0t0qmYlpCde0VfXD yF0QQYAzqiPfx9rg1nQ9y3vI5WzBoZpYq//wXdkjaTEFpyPEVYIt3/RmOBNhPQhrMY/OdxMB7g/ 7XsGZglObOvl+US/mgW5o6/um3HMQEqHlsU93M7Yc3S5x+xgyx0yyj2GdRDqzqUwqzvMVAD3aZ7 DQa+xbtHcb8pNH0VCrjdGjwEr2VGD5a+qMcvmfK7JWsVekRrRgbMa8ZxIa4oyl1YvMecwfurOmt DD5txy6Hz/jg3DikKuo4ywJPVREN/ISmjaGh5WIt1pHt5tLYfoUWeAzz9esUhan+BlEO1W7SxQX 0eTkIHEDSOvqCyDGZD3zrfx9xU3+oXbroy+uf9y5z5Y6GppztnO0QUI8hxVye0NWo= X-Received: by 2002:a05:6a20:5483:b0:395:ce56:4448 with SMTP id adf61e73a8af0-3a3cf68b511mr6112736637.25.1777608748275; Thu, 30 Apr 2026 21:12:28 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:27 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" , Christian Brauner , stable@vger.kernel.org Subject: [PATCH v3 3/9] pseries/papr-hvpipe: Fix null ptr deref in papr_hvpipe_dev_create_handle() Date: Fri, 1 May 2026 09:41:42 +0530 Message-ID: <31ad94bc89d44156ee700c5bd006cb47a748e3cb.1777606826.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" commit 6d3789d347a7 ("papr-hvpipe: convert papr_hvpipe_dev_create_handle() = to FD_PREPARE()"), changed the create handle to FD_PREPARE(), but it caused kernel null-ptr-deref because after call to retain_and_null_ptr(src_info), src_info is re-used for adding it to the global list. Getting the following kernel panic in papr_hvpipe_dev_create_handle() when trying to add src_info to the list. Kernel attempted to write user page (0) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on write at 0x00000000 Faulting instruction address: 0xc0000000001b44a0 Oops: Kernel access of bad area, sig: 11 [#1] ... Call Trace: papr_hvpipe_dev_ioctl+0x1f4/0x48c (unreliable) sys_ioctl+0x528/0x1064 system_call_exception+0x128/0x360 system_call_vectored_common+0x15c/0x2ec Now, the error handling with FD_PREPARE's file cleanup and __free(kfree) au= to cleanup is getting too convoluted. This is mainly because we need to ensure only 1 user get the srcID handle. To simplify this, we allocate prepare the src_info in the beginning and add it to the global list under a spinlock after checking that no duplicates exist. This simplify the error handling where if the FD_ADD fails, we can simply remove the src_info from the list and consume any pending msg in hvpipe to be cleared, after src_info became visible in the global list. Cc: Christian Brauner Cc: stable@vger.kernel.org Fixes: 6d3789d347a7 ("papr-hvpipe: convert papr_hvpipe_dev_create_handle() = to FD_PREPARE()") Reported-by: Haren Myneni Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 57 ++++++++++---------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 3392874ebdf6..402781299497 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -480,23 +480,10 @@ static const struct file_operations papr_hvpipe_handl= e_ops =3D { =20 static int papr_hvpipe_dev_create_handle(u32 srcID) { - struct hvpipe_source_info *src_info __free(kfree) =3D NULL; + struct hvpipe_source_info *src_info; + int fd; unsigned long flags; =20 - spin_lock_irqsave(&hvpipe_src_list_lock, flags); - /* - * Do not allow more than one process communicates with - * each source. - */ - src_info =3D hvpipe_find_source(srcID); - if (src_info) { - spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); - pr_err("pid(%d) is already using the source(%d)\n", - src_info->tsk->pid, srcID); - return -EALREADY; - } - spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); - src_info =3D kzalloc_obj(*src_info, GFP_KERNEL_ACCOUNT); if (!src_info) return -ENOMEM; @@ -505,26 +492,42 @@ static int papr_hvpipe_dev_create_handle(u32 srcID) src_info->tsk =3D current; init_waitqueue_head(&src_info->recv_wqh); =20 - FD_PREPARE(fdf, O_RDONLY | O_CLOEXEC, - anon_inode_getfile("[papr-hvpipe]", &papr_hvpipe_handle_ops, - (void *)src_info, O_RDWR)); - if (fdf.err) - return fdf.err; - - retain_and_null_ptr(src_info); - spin_lock_irqsave(&hvpipe_src_list_lock, flags); /* - * If two processes are executing ioctl() for the same - * source ID concurrently, prevent the second process to - * acquire FD. + * Do not allow more than one process communicates with + * each source. */ + spin_lock_irqsave(&hvpipe_src_list_lock, flags); if (hvpipe_find_source(srcID)) { spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); + pr_err("pid(%d) could not get the source(%d)\n", + src_info->tsk->pid, srcID); + kfree(src_info); return -EALREADY; } list_add(&src_info->list, &hvpipe_src_list); spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); - return fd_publish(fdf); + + fd =3D FD_ADD(O_RDONLY | O_CLOEXEC, + anon_inode_getfile("[papr-hvpipe]", &papr_hvpipe_handle_ops, + (void *)src_info, O_RDWR)); + if (fd < 0) { + spin_lock_irqsave(&hvpipe_src_list_lock, flags); + list_del(&src_info->list); + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); + /* + * if we fail to add FD, that means no userspace program is + * polling. In that case if there is a msg pending because the + * interrupt was fired after the src_info was added to the + * global list, then let's consume it here, to unblock the + * hvpipe + */ + if (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) + hvpipe_rtas_recv_msg(NULL, 0); + kfree(src_info); + return fd; + } + + return fd; } =20 /* --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 665F5311597 for ; Fri, 1 May 2026 04:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608754; cv=none; b=Bm34reSkfbEOpFgumrJtt5lBUYESTa2qSLR52TJERJUz3sDn3DgTphYWXzetYzTEHII189qM3JgAyCrBELlyoolKS6NpWK7s51WRaUdKMy5wXTvLM4Bfwqc2Y9zOZKX5oBvadpQ8Z+XsNejH33CvZkcQ/O+okFtMVGtaX5Hjp9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608754; c=relaxed/simple; bh=+Oi12GzLgtByjEF2wRqsc0NBBF8vvCA6FOOChN791o4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a7ll/f5ji1Mu/E1WkirTm3J5N7BSOSRvNaB8ArJnND+CbtdOfb2je31ms/KxQjNtMGjiSavCWhfJJyE5R4odhynciXLNyfupbuQUW67Ki/wp1Sm735oHTRRuTXesYIBWVPOQykNPAVVNht509BTpLN9TYKO72B5HqyQWpi2cbdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gNFNez8+; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gNFNez8+" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-8318293f02bso932323b3a.0 for ; Thu, 30 Apr 2026 21:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608753; x=1778213553; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FX+puozfKOk6l+f90pyqn7buO5CtmALr+6nyHUFvWvA=; b=gNFNez8+daeJEil9I/I4OboxepyBpMBbU/dBC7yphmqAUNCG2cOF2THHrsd0cYbe6m 53hJHb+HmmHhJCHTwTnSftzf0scBXeRobEm6uVRt8Y3xh/Hq91WIZdH32CgYMQswhBmm oyaGNUWOaBlH3wVJgQ8bjcfLU4rpHFrJyKJUuL3LoJ6pwOqnAlkm6HOUmgHsbYBFFNL5 WbnWgstYh/tyNPCI1NAgjNSVbJYAnJLiyB/EddPPHtNVEpwPS7pxEJXeW0UMpuoNWTl2 lzG4cJb3hVUI3+TkKB4JLtPhHCTWOWm/isOHSA0JhL8NA9Vl27x5pHWQUaPbcn7HdNRo RCgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608753; x=1778213553; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FX+puozfKOk6l+f90pyqn7buO5CtmALr+6nyHUFvWvA=; b=ELUDHaBNSBvWdlb/JxZhDPdmzPX4Ol1rG3bN09O+5ICKEE7Zt11bpuzEPWmbpNGo83 GVRo5lYimFt0kzQ98besNR/neJZxblzyrXezGWfh+/e8xrsLFpAkQBQxGI+GlngwpePO bkqh+7mU4o1PNgCqCdOjaKI9/F5rgTSZaM9Ljz2u+pspdfZlq7Jkhxd9ma5yu4745QSi GFoeqOLo91Nkwfq5Qi1a/PiLH94y75uCmtBBidNRc7rCz53V92+HYeIomdH0LGVDlvJu EioNNrDkoBSsKD4F2NqgS/MVr6kKvT6LfB6nvgvMsqFH2Zi4P0hEJ0msW4+Gjzm5v2aO 42Vg== X-Forwarded-Encrypted: i=1; AFNElJ/aqqzemhxvH9sK2tEh/+9IsJVHePQSI7A8sD2QXv8yn5cJW7/2oQamTlumbIS+9j1SLlVBRz1gFUqf1cg=@vger.kernel.org X-Gm-Message-State: AOJu0YwF58ca3CZ5BP7JQQHQz5ec36xxacW9xkX3cduxqEOUAbCnr/WN uYqnCPLnddmyfyl92/ZCol6KCwsatIZPHzK8j2Ow5quhZo5tP4FkL7Q4 X-Gm-Gg: AeBDiesnLEi6pVg1KDISMYcOHH7n8MoxkSG7ElfRZngecvrSFe+8BeR+petx3Ircb+H T1Do+PqpKgAUNEHumlgzzpLS6F98iImJYDC6709iM53IylqBl1FkgKl+WRGJHbVAV5Imin+JPnv XwgJsof32w6q36l6tHzmMC/65r/JysM6kmYh8wmS7pl5tqeNjRshqPSeFnQj4qLlqqxgOLsT7kW QMz3KU5PuTmLvTbH2npJ5i1bguYa09dSF7drQ4i8narY0JkHWdyrkMzr846a2S7VKJazPLoFG/A PbhJ9L3uAXCS15K4w3X3BfZ7UjHo3XSllEVFUlWkfGmxvaguyGjMXmXXLgCdr6QxFk99uU1G9j2 K44M/3aXfnQpdhxpeA7Vqw5wYNhid4qTaIMdS/eIXLJNknhj3wASPr0qmS4Ecw4BI3kDgdM2lcA PjSh8WMpA3OKlOasRaJBLgW5etVBpjEmQHqxF/v9wifAkhBsCuPBKQX23pDHMn7ccUNdr+lcHOA Q== X-Received: by 2002:a05:6a00:3e27:b0:82f:3774:4fdc with SMTP id d2e1a72fcca58-834fff78b31mr5164676b3a.1.1777608752763; Thu, 30 Apr 2026 21:12:32 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:32 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" , stable@vger.kernel.org Subject: [PATCH v3 4/9] pseries/papr-hvpipe: Fix & simplify error handling in papr_hvpipe_init() Date: Fri, 1 May 2026 09:41:43 +0530 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove such 3 levels of nesting patterns to check success return values from function calls. ret =3D enable_hvpipe_IRQ() if (!ret) ret =3D set_hvpipe_sys_param(1) if (!ret) ret =3D misc_register() Instead just bail out to "out*:" labels, in case of any error. This simplifies the init flow. While at it let's also fix the following error handling logic: We have already enabled interrupt sources and enabled hvpipe to received interrupts, if misc_register() fails, we will destroy the workqueue, but the HMC might send us a msg via hvpipe which will call, queue work on the workqueue which might be destroyed. So instead, let's reverse the order of enabling set_hvpipe_sys_param(1) and in case of an error let's remove the misc dev by calling misc_deregister(). Cc: stable@vger.kernel.org Fixes: 39a08a4f94980 ("powerpc/pseries: Enable hvpipe with ibm,set-system-p= arameter RTAS") Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 402781299497..800649f309a5 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -780,23 +780,29 @@ static int __init papr_hvpipe_init(void) } =20 ret =3D enable_hvpipe_IRQ(); - if (!ret) { - ret =3D set_hvpipe_sys_param(1); - if (!ret) - ret =3D misc_register(&papr_hvpipe_dev); - } + if (ret) + goto out_wq; =20 - if (!ret) { - pr_info("hvpipe feature is enabled\n"); - hvpipe_feature =3D true; - return 0; - } + ret =3D misc_register(&papr_hvpipe_dev); + if (ret) + goto out_wq; =20 - pr_err("hvpipe feature is not enabled %d\n", ret); + ret =3D set_hvpipe_sys_param(1); + if (ret) + goto out_misc; + + pr_info("hvpipe feature is enabled\n"); + hvpipe_feature =3D true; + return 0; + +out_misc: + misc_deregister(&papr_hvpipe_dev); +out_wq: destroy_workqueue(papr_hvpipe_wq); out: kfree(papr_hvpipe_work); papr_hvpipe_work =3D NULL; + pr_err("hvpipe feature is not enabled %d\n", ret); return ret; } machine_device_initcall(pseries, papr_hvpipe_init); --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE538311597 for ; Fri, 1 May 2026 04:12:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608759; cv=none; b=Is9m07HC/PKn/nDZMuMDaitEeDj4XI7BUpPGCRcUMKIDBRulxU5IAf+ofP3oRnlBuqyQ6UIDLk7g49K+LZ5ZQI50mTZNU4J9u+RzziJK+GtuUNYMp9YCLfI6CGn8FE2wIqGpAwt5YccSQCPU3k9gO/j6/aE/+H7ClV6i7zcJPz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608759; c=relaxed/simple; bh=dGazrhGlx+ydSCQdjAg++FU0k6A9TxsgZxMaz61j+IY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sDxAB9h4dsS7WOaChWmRIq4tusYHdugIOyLNBttrdiLj/9auzq0MLk81dDCduEYF4NCufLW02h+Q4OGTp7zVPUXd3QRwkb/sqQip+TQvMriAbdEyWEcenl9uHfLa/M38WCa/2/FYrEqo6emrb1YbCqdwiooqZzqJanavGBd0VIc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e1gqS1Bh; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e1gqS1Bh" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-c648bc907ebso1028573a12.3 for ; Thu, 30 Apr 2026 21:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608757; x=1778213557; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GzTwWKu4/OMgogLdvJRN18BQXd8VP1+UN2ymsqFSQ28=; b=e1gqS1BhjFPU1sGe/Ua51tWqHWZnsQNVURwaukN4QbrFPKaO3UvkebTDwBhiFJWmIV nOVSmYUPfm5SCzrcpSe/hzJIkTjNKlBtWWqDhvvx8Wa1SjUlcdkWnPWHMbQQL6wuIGra UYIgRZKGwrATVqQ/Gr2aiWxHDF6l/4Xeld1ztZCZYbzkcK6lkDjXMZinmry9/B5KCzVA iXEejjqAf2eEu198pi1/WqLSlaH8K3u7MFXpZTMjVNC/K1ai+TZfqk9U8skVH6miY8B3 CiCvByGwRrSubIl/5d6ErJC4CIzvCJn4d4fzqm0RcicMjqYwR2fD7bniLoBfR6BpWNal caRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608757; x=1778213557; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GzTwWKu4/OMgogLdvJRN18BQXd8VP1+UN2ymsqFSQ28=; b=V3NbU3i2c9B2LA9MS0UZ5mMEGKPlYsZ8fUvfcn5xnkYM9hJAvHcsgdnGOyW9oIDWBI wLPhxZfB+IKa+2IZb+oBjcScSfb4Ct+Crlwo7xOy5Q/LwUnB744QHD+yWgzkabsuvJfZ h/X7ozsQEMhD696KIZLI8WLyQUEr3SJYlmsSJtd2Cu8exzcDGkppqBgE5/SzCDJ39qPw 1z7tKp5ThlxJ42sTUWmYMSkFy3Nk7gt81GjbO/vdkQWpuWUTPIDmH0QTdris7mwO9GqV OwbrLF/XB+lZ4rlCX3wfHY9y3ZcVDbMHRRFNADIGmCLHwRcud12/UEbF189chsFKgDV4 KwCQ== X-Forwarded-Encrypted: i=1; AFNElJ+gK/BFCxy6dwLyGoFntQtT1uWXb2DPuXsxGekFPNfFvKvkoWo6fcI848t0lGjBMqzK845EcBwPPAMffAE=@vger.kernel.org X-Gm-Message-State: AOJu0YzRzERv53sPfMNnFKsFjXCNP8SHCOavU5a5OG+QqP+aTF974MTw T+CDGZw/si8mVvy9ttkefLJZA4kUYzFrhU3WgEvcKcFsna6XjJAc3qJZMhwDPyam X-Gm-Gg: AeBDiesniDA04OFeDyGho8BWYAA9CmBNm5Tce6zNwPFT/SYef6h5XjxWTm98M233sX0 h+VykCngZVQd0OALcbB2DHtlHCWyOo/RGL2PDk2CM7v5hjFsDMbrUBGY10XANcRiwMnqoyfs0/9 aZi5Q7jhmWc2Ql7MkG1GQE34YPL14fmF1Kdi4k02PkE3wO9Dha8J5ed3+voHoVnH1Gu+3qdOftl pfH2LnC5mG748SWeOFB73CSze2avz8essv4dBkxg2idg0waQoG2ljIV7LvkwMrFOyqIoHmxfdtY VvvibJkdsTnAqVwvkisIzMYt4GUCwNuv9Rbf8U8Ko0lQ9flOEQROxezppLALEzdsl0/GCxcfmUh 8nEmCWlTB9Xe2xs/Wr6H62iGUGJKiQmXVYtBt7Ucs5Gst9TWz2NE2U3uf//i6Dde3SOE8wdRcxE rPTerSiIFR3PWjt9g5yW7qVc0310TzyerTWs5cbb+94TEFJ7NCr9PYrCSz9o/ekjU= X-Received: by 2002:a05:6a20:2444:b0:39f:a42:9247 with SMTP id adf61e73a8af0-3a45fe026bbmr1846152637.37.1777608757090; Thu, 30 Apr 2026 21:12:37 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:36 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" , stable@vger.kernel.org Subject: [PATCH v3 5/9] pseries/papr-hvpipe: Fix the usage of copy_to_user() Date: Fri, 1 May 2026 09:41:44 +0530 Message-ID: <8fda3212a1ad48879c174e92f67472d9b9f1c3b7.1777606826.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" copy_to_user() return bytes_not_copied to the user buffer. If there was an error writing bytes into the user buffer, i.e. if copy_to_user returns a non-zero value, then we should simply return -EFAULT from the ->read() call. Otherwise, in the non-patched version, we may end up mixing "bytes_not_copied + bytes_copied (HVPIPE_HDR_LEN)" as the return value to the user in ->read() call Also let's make sure we clear the hvpipe_status flag, if we have consumed the hvpipe msg by making the rtas call. ret =3D -EFAULT means copy_to_user has failed but that still means that the msg was read from the hvpipe, hence for both cases, success & -EFAULT, we should clear the HVPIPE_MSG_AVAILABLE flag in hvpipe_status. Cc: stable@vger.kernel.org Fixes: cebdb522fd3edd1 ("powerpc/pseries: Receive payload with ibm,receive-= hvpipe-msg RTAS") Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 23 ++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 800649f309a5..c007560d2d8c 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -206,10 +206,11 @@ static int hvpipe_rtas_recv_msg(char __user *buf, int= size) bytes_written, size); bytes_written =3D size; } - ret =3D copy_to_user(buf, + if (copy_to_user(buf, rtas_work_area_raw_buf(work_area), - bytes_written); - if (!ret) + bytes_written)) + ret =3D -EFAULT; + else ret =3D bytes_written; } } else { @@ -328,7 +329,7 @@ static ssize_t papr_hvpipe_handle_read(struct file *fil= e, =20 struct hvpipe_source_info *src_info =3D file->private_data; struct papr_hvpipe_hdr hdr =3D {}; - long ret; + ssize_t ret =3D 0; =20 /* * Return -ENXIO during migration @@ -376,7 +377,7 @@ static ssize_t papr_hvpipe_handle_read(struct file *fil= e, =20 ret =3D copy_to_user(buf, &hdr, HVPIPE_HDR_LEN); if (ret) - return ret; + return -EFAULT; =20 /* * Message event has payload, so get the payload with @@ -385,19 +386,23 @@ static ssize_t papr_hvpipe_handle_read(struct file *f= ile, if (hdr.flags & HVPIPE_MSG_AVAILABLE) { ret =3D hvpipe_rtas_recv_msg(buf + HVPIPE_HDR_LEN, size - HVPIPE_HDR_LEN); - if (ret > 0) { + /* + * Always clear MSG_AVAILABLE once the RTAS call has drained + * the message, regardless of whether copy_to_user succeeded. + */ + if (ret >=3D 0 || ret =3D=3D -EFAULT) src_info->hvpipe_status &=3D ~HVPIPE_MSG_AVAILABLE; - ret +=3D HVPIPE_HDR_LEN; - } } else if (hdr.flags & HVPIPE_LOST_CONNECTION) { /* * Hypervisor is closing the pipe for the specific * source. So notify user space. */ src_info->hvpipe_status &=3D ~HVPIPE_LOST_CONNECTION; - ret =3D HVPIPE_HDR_LEN; } =20 + if (ret >=3D 0) + ret +=3D HVPIPE_HDR_LEN; + return ret; } =20 --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B885B3148D0 for ; Fri, 1 May 2026 04:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608762; cv=none; b=u4WCVuo9gnAHUmVXBGrBSljfnD/3B9PRD0OUbQE5Ik312tw3ARKlE57Z07Y3o6KjVt9OmuxqqFt7zzX0RlLwqhlYEMNWQqOXz6ShBz0BnXRdfWb2FwlROZSXGo3mmTLRlQE3K1nrLX5dsqOSFHb5O03yE5zexABwWF/T7MdABq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608762; c=relaxed/simple; bh=JNR9CceIkZSVhfpqw7PwsT9P3pAN3yJ1UUNCiBj+kjk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EoMmSDSFIm9D9vMlHKopgs7aRDZahZAuEzJo1LxMCpMI4uC9N2YNSwi2MuxqJkxpzXZPZ+Qdk2TNrxqA95fr7BNrQOOm3vTeUhO0WHPYRuc3gxbEWUNpeTNTZF90FIKd+Yxy10yFV0g4pHZqw4w4t3minaU1iY2iQT/Sj3Pgvck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Kk1UwxJ/; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kk1UwxJ/" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c7961d7bc09so661111a12.1 for ; Thu, 30 Apr 2026 21:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608761; x=1778213561; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QbcA+KKAK/mlL4ebrP1t22eLmSo5X81zXX537Har/90=; b=Kk1UwxJ/I/E6an2L1h3VJ7tbYEyU7+yYM7ModmW7b/Qf85CAMsQBMaruZnE6Sgckco 53jn85Jo4+TGaXOWCMMcWUmeCkX4nD0AzO78U6yTJgMz5e2Vo/OR8TAxmI/FfYYyEX83 qcQXEYs/FQkS99Q6g01J8ciQjiMdTXJh4I6iT+qhCdGYrCdD0Yy0rg59Oy1e1qC5mAMu z5VmbzCjd8Me2EERHF6cx88GN/FRAUcfbee7vMn9x2RUhBP4j4+tNKzSfu9cKobUxmQC cB1uby2ZFwOTLviYfwQTnRxPfleK1VZIFRYRf5+fyj8EMNA5RnQl9d02skUYqROq7a26 x85Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608761; x=1778213561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QbcA+KKAK/mlL4ebrP1t22eLmSo5X81zXX537Har/90=; b=mDTgKZt7R0yi/R2Wf6Yvkgx9uWEXytEBlVQH688WfipFXuqWk3rihgU2tM9/eTbJ0Q JPc9b8IVXgoqd0gS7ft5Dqg/fVAhudim1XDLBpuuQr4GOTabcONCsGY7oyRgEKw95tgP RUwfOvb0fdwbOYjHX53inGi/5ZDjyAfOcsv5hDmO37Qoj2iBlq481Wx38rDxbVTyztlr 29/hVLwBSRtf431/xv46K3EgRJHI4Raop3iqr+iKcsQBEkOXPWYqJpaBrWd5KMlR0mbs 04uAphCpxHu0XRUK9UTDihSrs6wwl5rWESmAvBHzXf+tvFLQZATa2LhgWJorMZc/Q3DI zAxA== X-Forwarded-Encrypted: i=1; AFNElJ8pbx+zPYeF29wdsP/vhlwuzybrWsCrLmCfLGDZ6pjLsNGDvMXwPhs/BK/KGfD4r/KabjSi3rfi3x7vPhY=@vger.kernel.org X-Gm-Message-State: AOJu0YxZHj7m90XDJomqbXJFFH5uSnP0Du7phdZP6CCKD5WwFnT/I5vO jJ/FZ4sjU+00lDO20bXkeoMqyQ9P01xO1ymOJx1BInhnhchJHAWNIo/N X-Gm-Gg: AeBDievWkYVi3nDC9SJ/ZXgdu2CBVmdSyp39sLLwxNw6s2g4MD7iAoBL8UWt0POJuQy GR0aVSjbYFWzo/zOV7/RmsLjbV4/ilsHSYHh39fkhfXyPI6GYVpElDfVEo8yPO/a5Vl7CcvFoNB rBi1YLBDJzAmcMMbKktC6s9AodU66qi7J6Y8i0cMZmj6Nd57DMcJz/BwKQBA9Fs51Rpke4Z4c7x J2OHmJZ8EPtr6RufBkMbnpNM5c3xg8wUDDGfdzjL7MlcK/JX1vmgYcBrpRzq1cUeONoDUuoMQvL GlJKB8pVzPBMptROWa3HH338Mtdh/2ED4gcv+k0BhIrnHsvtNoBS7nvpcZuJW/uXw1wH3mW5gBz JMxrfqet4JmdDI3St/YxB2yza1+29l9GURbpFcLpN6LsA/9ogY+6OP/nSvzUeCtB11UVW3YDWob k3ccMI3RQwqsa7ffoaiIXqzMT4HAUl6IEfdn3m/PDzhDGrzpmf63BOzLvgmceQgj4= X-Received: by 2002:a05:6a21:33a7:b0:3a3:add5:7bf7 with SMTP id adf61e73a8af0-3a3cf68979amr6497104637.23.1777608761081; Thu, 30 Apr 2026 21:12:41 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:40 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [PATCH v3 6/9] pseries/papr-hvpipe: Simplify spin unlock usage in papr_hvpipe_handle_release() Date: Fri, 1 May 2026 09:41:45 +0530 Message-ID: <4a980331557af3d10aada8576aaa16cddc691c65.1777606826.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Once the src_info is removed from the global list, no one can access it. This simplies the usage of spin_unlock_irqrestore() in papr_hvpipe_handle_release() Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index c007560d2d8c..5aa37f6ad8c9 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -460,6 +460,7 @@ static int papr_hvpipe_handle_release(struct inode *ino= de, src_info =3D file->private_data; list_del(&src_info->list); file->private_data =3D NULL; + spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); /* * If the pipe for this specific source has any pending * payload, issue recv HVPIPE RTAS so that pipe will not @@ -467,10 +468,8 @@ static int papr_hvpipe_handle_release(struct inode *in= ode, */ if (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) { src_info->hvpipe_status =3D 0; - spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); hvpipe_rtas_recv_msg(NULL, 0); - } else - spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); + } =20 kfree(src_info); return 0; --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3032B319871 for ; Fri, 1 May 2026 04:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608767; cv=none; b=KuQ4uWq2RUMJYDPk+Iz71foNTS9avnDpssmQRd7e/8QenYNFRuCMUkKZBnGdOQbIKCjOzZXRP/uXzJ0m/fwGKx8jnql0+mM8k09NSf8tePLd+n4zsslGjKxMmb4yG4aO4zQ94KpLsBErjjxjTnEeFpYgLscprYOoUwVP1S5Wrzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608767; c=relaxed/simple; bh=VpI8+gHb39G+vtg8UaTYzQvDsfOLoqFR/FptPd99UPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CmCMs5JPGnaYMPF7yD21ohxvY4aJboDhViWGrFEbIzjvXJfFbySq8W4UoLcqgSxUpKuhmB7NaJCnqgW4PAtoQWL3jinFMd48J3zJL1/gxl+ppBmDarNozG7BCsJnUGFcD5nv3Qy2f2UX9huPFK9PZkchSSgkJk0hDXWQneJY6f4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fI+LZpSN; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fI+LZpSN" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-82fbdd60b64so1197395b3a.3 for ; Thu, 30 Apr 2026 21:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608765; x=1778213565; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QMCX/8Rx1DH/VKMyWagi6FXZnymSiiQzOS5vntFU8d4=; b=fI+LZpSNlYAi/6MEai/mmS53SN6LKI6nbQW5fX617nYvFwad1NYsPIufysino4Womi k2GbtPsHJuBStUCHu8CwjRMC4NWD6WFTWl+41Fd/uxb5IbFtL+Lw1jtaOFxhsVuaJXOI y4TxKxSMPs6boK2b2oi142hR7UZvuvuEkxTMN2EV16r1Mwi/zmg5Om1c+uLogfi8SOEF 4Vk1F19Fmgx0LC7/ulwzTCHJOOFcSSMjfDeDkEygGxcoFDO9OkPVJ1jdKKtBXBd8T9Kz laDml/kiyaE7N6rtcRjr2xw8LjetUuVvDRImtn0TCCevccCpXDfNkC7jzhS+kzFZcg11 w0dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608765; x=1778213565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QMCX/8Rx1DH/VKMyWagi6FXZnymSiiQzOS5vntFU8d4=; b=eVMtw7cW48POjQG6FxCMj/pv3DA+RAzqPcUMTjhICxH4EnT4+7/vK4upsIOWZ1Tx+3 W+11XhS+5Nlpfd6KBJdlBUCJoVe90q1T3XkD0L3EFsW6pgZwoulzlMcyIo91MSS2gCiy j6lYdQgug/hitH+6jYuN15BVqbMIyWcrQBvctUj5QpKY32DFGcTWNfkfDZyee+b9081H IG+4ydQeQa5LntNtSR7jgixPwKkD91cCq8ijjz0WDo6oCjck+QE+U9HnpCPAEJBwEbtY jT3cgXmhgCM/1OvOEg9xE4ZRzBig48esY+DoK4Wo11VWPKI1t+cJM+bL30+US+AFX08r mYeQ== X-Forwarded-Encrypted: i=1; AFNElJ9Qfy1TmabNmONne5pJbgreexRXKNx11OnJ+AsS+V97Dm/x09w0xqOxRJcpxL2pJ0t67xrag7+cV538uzE=@vger.kernel.org X-Gm-Message-State: AOJu0YzZ4AVL9ccNRhi8M/Mxeyk1s5CRCRQKhfo5csRBXtIVxaGWNFvX h737HeeuwlulE93VJOn8zuq1LJe294upu7Pjckw7eCNjOowuCBp6oSI0 X-Gm-Gg: AeBDieuwCVhxFeUeFmcwwX2GsxzUYqHzVZyiNNsI7Efa0k6BzE9GLRG1Mu2eEpC1ppF opWwNhAPR3MK972Owxe+sgVJ5bY89lk1JVU2D+wLyTDN/Nsj8dFiUw7ywf4mzvyYLkosOYPCH1E TxYe5EMJ72ybH+2IQd9BOEzvxNlKdIURYdrKTJ+/FCXQJws9LFC/LAsjP3DjsTP9Aw5CdloRaCS F8faimnENQ/lSaJ9ndYrU8ghNeg9uCEoS1FnJe9D3O5brJQn6HXZLis2qrTRUc0p6frQE8BwaBH lLJPumwK2frUmWZJ5clvmCJKaj1C0oo+XqCfkIqgMxb4LnZ3pmKfg/rvGpfpI6zPaNQrg2t25az nM0kIPL8YOzOFRl4iNBaqxU3vhE7+XXHkdJJd8iVSVeFqw6AeIaZobjnbfOj8Dz1RuAIrkvsjG1 oqQ+LOXKTTSNURc8BMzKv1obxzUKbPerD8m22zEqTEF2l7G9f/Zhyuq8frwJ+P/ds= X-Received: by 2002:a05:6a00:4f92:b0:82c:70a8:faee with SMTP id d2e1a72fcca58-8351a0a52acmr1599525b3a.6.1777608765440; Thu, 30 Apr 2026 21:12:45 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:44 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [PATCH v3 7/9] pseries/papr-hvpipe: Kill task_struct pointer from struct hvpipe_source_info Date: Fri, 1 May 2026 09:41:46 +0530 Message-ID: <895e061e45cdc95db36fa7f27aa1922b81eed867.1777606826.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We don't really use task_struct pointer for anything meaningful. So just kill it for now, and we can bring back later if we need this for any future debug purposes. Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 5 ++--- arch/powerpc/platforms/pseries/papr-hvpipe.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 5aa37f6ad8c9..46159f1c1cf1 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -493,7 +493,6 @@ static int papr_hvpipe_dev_create_handle(u32 srcID) return -ENOMEM; =20 src_info->srcID =3D srcID; - src_info->tsk =3D current; init_waitqueue_head(&src_info->recv_wqh); =20 /* @@ -503,8 +502,8 @@ static int papr_hvpipe_dev_create_handle(u32 srcID) spin_lock_irqsave(&hvpipe_src_list_lock, flags); if (hvpipe_find_source(srcID)) { spin_unlock_irqrestore(&hvpipe_src_list_lock, flags); - pr_err("pid(%d) could not get the source(%d)\n", - src_info->tsk->pid, srcID); + pr_err("pid(%s:%d) could not get the source(%d)\n", + current->comm, task_pid_nr(current), srcID); kfree(src_info); return -EALREADY; } diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.h b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.h index c343f4230865..4bdf7bb2fc4d 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.h +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.h @@ -21,7 +21,6 @@ struct hvpipe_source_info { u32 srcID; u32 hvpipe_status; wait_queue_head_t recv_wqh; /* wake up poll() waitq */ - struct task_struct *tsk; }; =20 /* --=20 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E88831F997 for ; Fri, 1 May 2026 04:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608771; cv=none; b=dJBG6yQVb8w6v/CP/SupOHN7+ia0a2V6J6bHqjtAgoGAJnclr6vhi1TN3Y8Jebhp6ik4QqhDFYR1h+gNks8/zZvlViTUXbjWgRFLVkdaDBj2iR8omt9MAKVIp8cQg/xc5w8djKyWt8rUfji4xTyAKdL8/N8AQwWT8jnpjAYPpkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608771; c=relaxed/simple; bh=JQiMt4k27JP9YGtVOe0AmtKjjUOh8nYiK7BUBFyyjxY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KZnm5MWrcR015Jkellp6v5FCqm3fFkJSFFAo9PotBWbYs8zRaKYevNxJ+ZmFtUHCHiK/42xYIJh6d5S1DRs/Vq6BjkTrV9ireJNNuJiLHcxvD/db8bvAyEPWkf+pIXQ00nDeJqjpiVOTEYgs5N9N6ceKqJOQ3EqOfYmAN7SE/S4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a95hmJFQ; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a95hmJFQ" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-82f351ca23cso764257b3a.2 for ; Thu, 30 Apr 2026 21:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608769; x=1778213569; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tmK0ukFVMjb3b7sfCs+v8o+MM2eoVKnNMBXjoF9UXgk=; b=a95hmJFQToibaN6fPBeim4Hn8tbMG5HolR4y3g6kifvL5uTNdanBup5v/GKhJNDyBp MHaY7G1KE53BjqL2idvPIwLhLHYJgozFPDgs2CCS3wR6ZkrcpGlZo646kmFXYeFksex3 UDemx+Wf3uOsI1w3xkgoXi0mo41TAecDyyRIrm8lEqeIs35S8+iHkyDS2Uk760El4b5c PPZkv3vGC526YGQhLlZVRiBJJvgmm9vcjw5/uIrauwljE1oNbwYO7SVLRYiFVs2ex35X YYq0aD5BZwQoLe86cgDlON9ztxkPi5dNiIY5fwVel3nsvPJx2tj8S9PL5xVquz1pIWkm M+gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608769; x=1778213569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tmK0ukFVMjb3b7sfCs+v8o+MM2eoVKnNMBXjoF9UXgk=; b=qfBIBZj6n72rOYvpLvVR2oI+t/QWf/bq4MZ3e1QcDlLagO2Zw6q3yEvf0pz8FKlMSm Pu260XnoNAn2KJGhhCENY6XehJwZEg2Uh+/64hncuLvgBWVrPgWLjPd3LSb1G0nkeBb3 ekCo27VmTQToz7DtUGJnty+q9fiO9t0/V0PjFw4SPcxO5Of6PR5Dh40znvVx+W5gH5qO 0pvgD9T88ri8aKbrSE4EUFLM3d11OqVXTe9dq4kjQQPYTO2vDkDEkPZwBYA7MBPrRa35 B77MbddNu9xPup7VGOpu3LoS8osh1pVKRY0FbW5QodllniNfNRFYTc26LKj/gZL+YRlZ A8xQ== X-Forwarded-Encrypted: i=1; AFNElJ8xi2QHS1jYM5mlfLr0g4kMMkLMK5CkrQUlVfGkyqk3d6FGNrVDlyhdBnXqw6T/2ZPEMW6E9FdgADcRehU=@vger.kernel.org X-Gm-Message-State: AOJu0YyhztfYtHZt8svGMUClu/m0LpJk1BHKJBxxs9PiF2UezuHok341 2WrGMkLj1p6+oHvSZWKXFZEX93mIbrJ4x7pgIfLo7aFY4wUW6LKvkmdA X-Gm-Gg: AeBDiethgBiCWBBjEJeiurSlWiMofhwERtELHZGUacy+JeUo87g+k4pnsVL03D9W4Nc 01OUjjiIuZnwfyRjuTq10lm7LfGym//tmxXEjDLq5WkGSz1hvYFP53siOxdwI9+CjqUF2pdOrPW JOA/mFJKbNXB4sr8JY4c42zEwPqcnz1MNjc8btaAf5riELOhaL++oIQ3U5YigpMRmkVud3Qlj3u kJr2ryJzFaZvoAKxupDZE8m14c1A5XMm8nJzxzQ9XTlv8JoRBqIeTbLwEFv0T2y2LPBQ4Avuma8 Nv20aA+fLts1MWyVIHc0u0SCdr+FAM2VfLMOgY421888EVJqrsjFk7TpkkT74Y8hgmbZ21oomLw zGBaGBbAeEqB6zvYJ2Gv9JfNKGfAW/7SNGz73g6Swj5LiBYRZbgElfD/NY65NZYDksHxDyA9Krk 2d564X9xBQtF8o/UtPzlD/pFT/2ICUXPa5MT7BaO0UUdZlBl0oC9v8xpob1yWuWlA= X-Received: by 2002:a05:6a00:1ca5:b0:82f:5154:d1d9 with SMTP id d2e1a72fcca58-834fdb07c68mr7050443b3a.6.1777608769448; Thu, 30 Apr 2026 21:12:49 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:48 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [PATCH v3 8/9] pseries/papr-hvpipe: Refactor and simplify hvpipe_rtas_recv_msg() Date: Fri, 1 May 2026 09:41:47 +0530 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Simplify hvpipe_rtas_recv_msg() by removing three levels of nesting... if (!ret) if (buf) if (size < bytes_written) ... this refactoring of the function bails out to "out:" label first, in ca= se of any error. This simplifies the init flow. Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 52 ++++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 46159f1c1cf1..3688b2be0445 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -190,34 +190,34 @@ static int hvpipe_rtas_recv_msg(char __user *buf, int= size) return -ENOMEM; } - ret =3D rtas_ibm_receive_hvpipe_msg(work_area, &srcID, - &bytes_written); - if (!ret) { - /* - * Recv HVPIPE RTAS is successful. - * When releasing FD or no one is waiting on the - * specific source, issue recv HVPIPE RTAS call - * so that pipe is not blocked - this func is called - * with NULL buf. - */ - if (buf) { - if (size < bytes_written) { - pr_err("Received the payload size =3D %d, but the buffer size =3D %d\n= ", - bytes_written, size); - bytes_written =3D size; - } - if (copy_to_user(buf, - rtas_work_area_raw_buf(work_area), - bytes_written)) - ret =3D -EFAULT; - else - ret =3D bytes_written; - } - } else { - pr_err("ibm,receive-hvpipe-msg failed with %d\n", - ret); + /* + * Recv HVPIPE RTAS is successful. + * When releasing FD or no one is waiting on the + * specific source, issue recv HVPIPE RTAS call + * so that pipe is not blocked - this func is called + * with NULL buf. + */ + ret =3D rtas_ibm_receive_hvpipe_msg(work_area, &srcID, &bytes_written); + if (ret) { + pr_err("ibm,receive-hvpipe-msg failed with %d\n", ret); + goto out; } + if (!buf) + goto out; + + if (size < bytes_written) { + pr_err("Received the payload size =3D %d, but the buffer size =3D %d\n", + bytes_written, size); + bytes_written =3D size; + } + + if (copy_to_user(buf, rtas_work_area_raw_buf(work_area), bytes_written)) + ret =3D -EFAULT; + else + ret =3D bytes_written; + +out: rtas_work_area_free(work_area); return ret; } -- 2.39.5 From nobody Mon Jun 15 06:26:13 2026 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1268B32E757 for ; Fri, 1 May 2026 04:12:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608775; cv=none; b=I4YzpmTRXTyI7/xARwazriIX7doQLDUFUTv2vNXDtXm+LWdoCpPq4g6VL6YvkUcTeo9uraYFR6LXsmCQIMmI3YLEzZfzDBtZJk0QaN3G5aO3I83N39JOTZ2ku5Y8iBJPo+WvGnov0YJc3+94InxyBoj75Ry8+WqtWvAjcrfQsBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608775; c=relaxed/simple; bh=dWJS/fw8NUublwHDcglgk3BPs8DiqWY/vMinIAeCDGQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RMC2lezT+6zme0YGnfpwROr7bIO/P0ApZRgjxvmLrZox+R0ibk5N0T+0FS+nUxClZ2CR/friZ+0pBhpdgjT3IIcP3cpPqH3xpmtYNy0gnY7tVg1EC9QcswfmOzA1El7mZLeVsB1jTGa91l78Hr57gvtJsoqI+EJdY/aqlBuXENM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=p9T4iwUG; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p9T4iwUG" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-82f1bfc9b8fso767951b3a.1 for ; Thu, 30 Apr 2026 21:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608773; x=1778213573; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1IdD6EU2KzCmQB+Jz51O2QI4Dbo0L2jyb+O2zTYQf2I=; b=p9T4iwUG4sep6LR8P5HxjoKBivdrqG+y5/wWiibaQZVn+k5ay7nNJIVZQ/l36jGJfD JSXOcnLyqlg2sVSuTLu4KT5PkIM502y2TVmcX84ExeBwMvyUak+LPJrsl8PSn2WE6HSL Z9QusMjCdr2+D6EoM2yuSyRTDB/fDGDPePAR1VK4/hKO1PQIGxCe06YgeLq3vw7Z4/Qq ILolokAqIlrdSITPzX+TUEQiBxJtyN708qwDIgmSH6ixemyusRkvBfN8waxo048LnqCU cm1x/Wf42MxDWXtsnNeQGUlD+OdJlaUtbhSf9a++irRLqj/C+7SB1fsREbd+2TWv9icb VlyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608773; x=1778213573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1IdD6EU2KzCmQB+Jz51O2QI4Dbo0L2jyb+O2zTYQf2I=; b=gr1208WYWGWk/VS6Qdjb2aCmbFKOF9JdXJqPsGKSDc+3oIEcDZngPD8QjKX+YWPnwI W12n7aoIK/2FeDaKfGGoweMfuOjj9TNoxs9EpNyjR8OCruU2vEQZTGAEaxByObDcisK2 Ym1b93sBEfWTltDm0EFeYV0wgpFGgvFmMcc4NolGILnCPoOCo1UskjKVl8IK3IwqAxeb J3HuCVBCGTqVv15Jz2accQOFt6x5b4c7qBfOHp6lc1M7VfixRdc3MCYkzzq6o+JfF42y aqBTCajz9bLp5VlpfLqCCQRh99p1u3kzch1ejRuHW+vX/Os/0Fn7HzxY7S1eFrkGVwj0 uiRA== X-Forwarded-Encrypted: i=1; AFNElJ/SVYIYEPFJ9XOl1OnLP7F2Os3sQCqiSy+/DlACo86SIG3ZdiM+yaPqnFQbw1JEJAaCzbapVRkSZoJL2rU=@vger.kernel.org X-Gm-Message-State: AOJu0YxCG/SupwRJCEHbelg4ZRaozUY50OYTjJ8QqUxxdcTDo/E0Y/od ET8neu6uIdH6wxYDd47y6CkluUnaQ+qYTI3xZUt/odAoB4WIzsxmBQv44mJrfuA2 X-Gm-Gg: AeBDiesYyxjpgTroR2Yi1wr39OE4sodMd/AgbgwMOoyMnUl7DXCJpsIuApPE/1CWe6p eMCCBNnmRGz2BD+osfkU6/uEgCOWPa57tmVVfjQAhZbDdEFO9LQ7D83HMtp62t+qPu3BxqJXO2J K9Lozc2kMvRcvN4M5isHa12aTnjPCsSmNWzlbDWpgFnp0++dSOtPWBOWcSjvyB/AJCtx+m29y0a a9Hcj5LQCEyoU+5P2ngymC70A6WW/QbUGcJwO61vz0upBt1MbTUGI90X6wkskQyeZxIkp8t4gf/ hpj9Ux85EBJ+tVQwbmQHEbIzudpamvdaKy4EjM/3S0yg8sMKPMPl//OAMFgeFdWHadiQQWuyo9F gH3FjxM0MxAv6zvYuC4T547JBrPoOYV+0VGTCd3pEcIT1eMvS60Awcs/lk8yn6C/Gyn8SDT2jie VFEXeejh1OnTk5GkbLsbkbGNdM5BWqhgWgqUxwY+xVatteN+5yvxvWp4QVua8KQCs= X-Received: by 2002:a05:6a00:2998:b0:82c:9897:70ef with SMTP id d2e1a72fcca58-834fdbd1668mr6648388b3a.27.1777608773485; Thu, 30 Apr 2026 21:12:53 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:52 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [PATCH v3 9/9] pseries/papr-hvpipe: Fix style and checkpatch issues in enable_hvpipe_IRQ() Date: Fri, 1 May 2026 09:41:48 +0530 Message-ID: <1174f60d0ae128e773dbefd11dd8d46d69e7f50e.1777606826.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While at it let's also fix the similar style issue in enable_hvpipe_IRQ() function. This also fixes a minor checkpatch warning which I got due to an extra space before " =3D=3D". Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/pl= atforms/pseries/papr-hvpipe.c index 3688b2be0445..0c40bdde45e2 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -693,20 +693,19 @@ static int __init enable_hvpipe_IRQ(void) struct device_node *np; =20 hvpipe_check_exception_token =3D rtas_function_token(RTAS_FN_CHECK_EXCEPT= ION); - if (hvpipe_check_exception_token =3D=3D RTAS_UNKNOWN_SERVICE) + if (hvpipe_check_exception_token =3D=3D RTAS_UNKNOWN_SERVICE) return -ENODEV; =20 /* hvpipe events */ np =3D of_find_node_by_path("/event-sources/ibm,hvpipe-msg-events"); - if (np !=3D NULL) { - request_event_sources_irqs(np, hvpipe_event_interrupt, - "HPIPE_EVENT"); - of_node_put(np); - } else { - pr_err("Can not enable hvpipe event IRQ\n"); + if (!np) { + pr_err("No device node found, could not enable hvpipe event IRQ\n"); return -ENODEV; } =20 + request_event_sources_irqs(np, hvpipe_event_interrupt, "HPIPE_EVENT"); + of_node_put(np); + return 0; } =20 --=20 2.39.5