Skip to content

Commit

Permalink
[PATCH] CIFS: fix cifs_user_read oops when null SMB response on force…
Browse files Browse the repository at this point in the history
…directio mount

This patch fixes an oops reported by Adrian Bunk in cifs_user_read when a null
read response is returned on a forcedirectio mount.

Signed-off-by: Dave Kleikamp <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Steve French authored and Linus Torvalds committed Feb 15, 2006
1 parent 10ee39f commit 93544cc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,13 +1442,15 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
&bytes_read, &smb_read_data,
&buf_type);
pSMBr = (struct smb_com_read_rsp *)smb_read_data;
if (copy_to_user(current_offset,
smb_read_data + 4 /* RFC1001 hdr */
+ le16_to_cpu(pSMBr->DataOffset),
bytes_read)) {
rc = -EFAULT;
}
if (smb_read_data) {
if (copy_to_user(current_offset,
smb_read_data +
4 /* RFC1001 length field */ +
le16_to_cpu(pSMBr->DataOffset),
bytes_read)) {
rc = -EFAULT;
}

if(buf_type == CIFS_SMALL_BUFFER)
cifs_small_buf_release(smb_read_data);
else if(buf_type == CIFS_LARGE_BUFFER)
Expand Down

0 comments on commit 93544cc

Please sign in to comment.