]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pseries/papr-hvpipe: Prevent kernel stack memory leak to userspace
authorRitesh Harjani (IBM) <ritesh.list@gmail.com>
Fri, 1 May 2026 04:11:41 +0000 (09:41 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 6 May 2026 02:00:24 +0000 (07:30 +0530)
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-hvpipe-msg RTAS")
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/7bfe03b65a282c856ed8182d1871bb973c0b78f2.1777606826.git.ritesh.list@gmail.com
arch/powerpc/platforms/pseries/papr-hvpipe.c

index c41d45e1986d14c69b138047e7e3f21f0740d5a6..3392874ebdf686c3977c41afcf95b936a9ce7451 100644 (file)
@@ -327,7 +327,7 @@ static ssize_t papr_hvpipe_handle_read(struct file *file,
 {
 
        struct hvpipe_source_info *src_info = file->private_data;
-       struct papr_hvpipe_hdr hdr;
+       struct papr_hvpipe_hdr hdr = {};
        long ret;
 
        /*