Skip to contentSkip to conversation

smb: client: fix wrong index reference in smb2_compound_op()

PATCH In review Sang-Heon Jeon 2 participants 2 messages Sep 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: fix wrong index reference in smb2_compound_op()

In smb2_compound_op(), the loop that processes each command's response uses wrong indices when accessing response bufferes.

This incorrect indexing leads to improper handling of command results. Also, if incorrectly computed index is greather than or equal to MAX_COMPOUND, it can cause out-of-bounds accesses.

Fixes 3681c74d342d ("smb: client: handle lack of EA support in smb2_query_path_info()") # 6.14

---
I was unable to reproduce this issue in my environment, but the code flow clearly looks like typo error. I have not added stable cc-ing yet, leaving it to the reviewers' judgment, but IMHO i think it should be needed.

I would be happy to help with testing if anyone can provide reproduction steps or additional help on triggering this code path. Always thanks for your consideration.

---
 fs/smb/client/smb2inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/smb2inode.c +1 -1
index e32a3f338793..0985db9f86e5 100644
@@ -687,7 +687,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 	}
 
 	for (i = 0; i < num_cmds; i++) {
-		char *buf = rsp_iov[i + i].iov_base;
+		char *buf = rsp_iov[i + 1].iov_base;
 
 		if (buf && resp_buftype[i + 1] != CIFS_NO_BUFFER)
 			rc = server->ops->map_error(buf, false);
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Sang-Heon Jeon

In smb2_compound_op(), the loop that processes each command's response uses wrong indices when accessing response bufferes.

This incorrect indexing leads to improper handling of command results. Also, if incorrectly computed index is greather than or equal to MAX_COMPOUND, it can cause out-of-bounds accesses.

Fixes 3681c74d342d ("smb: client: handle lack of EA support in smb2_query_path_info()") # 6.14

---
I was unable to reproduce this issue in my environment, but the code flow clearly looks like typo error. I have not added stable cc-ing yet, leaving it to the reviewers' judgment, but IMHO i think it should be needed.

Quoted 6 lines

I would be happy to help with testing if anyone can provide reproduction steps or additional help on triggering this code path. Always thanks for your consideration.

---
 fs/smb/client/smb2inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Nice catch!