Skip to contentSkip to conversation

Patch "netfs: Fix potential uninitialised var in netfs_extract_user_iter()" has been added to the 6.18-stable tree

PATCH [email protected] 1 participant 1 message May 23 Filesystems netfs library

lore
Share & tools
lore

[email protected]

author Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

netfs: Fix potential uninitialised var in netfs_extract_user_iter()

to the 6.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
netfs-fix-potential-uninitialised-var-in-netfs_extract_user_iter.patch
and it can be found in the queue-6.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From 7e3d8db899d54af39fafb2eb3392b0cdae9973b5 Mon Sep 17 00:00:00 2001
From: David Howells <[email protected]>
Date: Tue, 12 May 2026 13:33:45 +0100
Subject: netfs: Fix potential uninitialised var in netfs_extract_user_iter()

From: David Howells <[email protected]>

commit 7e3d8db899d54af39fafb2eb3392b0cdae9973b5 upstream.

In netfs_extract_user_iter(), if it's given a zero-length iterator, it will fall through the loop without setting ret, and so the error handling behaviour will be undefined, depending on whether ret happens to be negative. The value of ret then propagates back up the callstack.

Fix this by presetting ret to 0.

---
 fs/netfs/iterator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/netfs/iterator.c +1 -1
@@ -43,7 +43,7 @@ ssize_t netfs_extract_user_iter(struct i
 	unsigned int max_pages;
 	unsigned int npages = 0;
 	unsigned int i;
-	ssize_t ret;
+	ssize_t ret = 0;
 	size_t count = orig_len, offset, len;
 	size_t bv_size, pg_size;
 

Patches currently in stable-queue which might be from [email protected] are

queue-6.18/netfs-fix-error-handling-in-netfs_extract_user_iter.patch queue-6.18/netfs-fix-potential-uninitialised-var-in-netfs_extract_user_iter.patch queue-6.18/lib-kunit_iov_iter-fix-memory-leaks.patch