diff options
author | Steve French <smfrench@austin.rr.com> | 2006-02-14 23:30:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-14 22:46:25 -0500 |
commit | 93544cc6486bea12e127ed58ca33477bb6ceafe6 (patch) | |
tree | 94eda2f741603fbf350bb8849b3291920d991d52 /fs/cifs/file.c | |
parent | 10ee39fe3ff618d274e1cd0f6abbc2917b736bfd (diff) |
[PATCH] CIFS: fix cifs_user_read oops when null SMB response on forcedirectio 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 <shaggy@austin.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index d17c97d07c80..675bd2568297 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1442,13 +1442,15 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1442 | &bytes_read, &smb_read_data, | 1442 | &bytes_read, &smb_read_data, |
1443 | &buf_type); | 1443 | &buf_type); |
1444 | pSMBr = (struct smb_com_read_rsp *)smb_read_data; | 1444 | pSMBr = (struct smb_com_read_rsp *)smb_read_data; |
1445 | if (copy_to_user(current_offset, | ||
1446 | smb_read_data + 4 /* RFC1001 hdr */ | ||
1447 | + le16_to_cpu(pSMBr->DataOffset), | ||
1448 | bytes_read)) { | ||
1449 | rc = -EFAULT; | ||
1450 | } | ||
1451 | if (smb_read_data) { | 1445 | if (smb_read_data) { |
1446 | if (copy_to_user(current_offset, | ||
1447 | smb_read_data + | ||
1448 | 4 /* RFC1001 length field */ + | ||
1449 | le16_to_cpu(pSMBr->DataOffset), | ||
1450 | bytes_read)) { | ||
1451 | rc = -EFAULT; | ||
1452 | } | ||
1453 | |||
1452 | if(buf_type == CIFS_SMALL_BUFFER) | 1454 | if(buf_type == CIFS_SMALL_BUFFER) |
1453 | cifs_small_buf_release(smb_read_data); | 1455 | cifs_small_buf_release(smb_read_data); |
1454 | else if(buf_type == CIFS_LARGE_BUFFER) | 1456 | else if(buf_type == CIFS_LARGE_BUFFER) |