Skip to content

Commit c588281

Browse files
vaverinsashalevin
authored andcommitted
cifs_dbg() outputs an uninitialized buffer in cifs_readdir()
[ Upstream commit 01b9b0b ] In some cases tmp_bug can be not filled in cifs_filldir and stay uninitialized, therefore its printk with "%s" modifier can leak content of kernelspace memory. If old content of this buffer does not contain '\0' access bejond end of allocated object can crash the host. Signed-off-by: Vasily Averin <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 99b79b1 commit c588281

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/cifs/readdir.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
847847
* if buggy server returns . and .. late do we want to
848848
* check for that here?
849849
*/
850+
*tmp_buf = 0;
850851
rc = cifs_filldir(current_entry, file, ctx,
851852
tmp_buf, max_len);
852853
if (rc) {

0 commit comments

Comments
 (0)