smb: client: fix wrong index reference in smb2_compound_op()
Subsystems (2)
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.
---
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
@@ -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
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.14Signed-off-by Sang-Heon Jeon <[email protected]>---
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!