diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2014-07-10 02:21:15 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2014-08-02 02:23:04 -0400 |
commit | 2e8a05d80213cdfbf3bf8e6eb3059831c7015e89 (patch) | |
tree | 571a362d0bb4af0d8e2a7e60b9082d906221b329 /fs/cifs | |
parent | b3160aebb49b5e07f6bc3b8c5bed6013ca9e422e (diff) |
CIFS: Fix possible buffer corruption in cifs_user_read()
If there was a short read in the middle of the rdata list,
we can end up with a corrupt output buffer.
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 3ea6fc86a471..c3390e2c6e0d 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -3049,7 +3049,9 @@ again: | |||
3049 | } else { | 3049 | } else { |
3050 | rc = cifs_readdata_to_iov(rdata, to); | 3050 | rc = cifs_readdata_to_iov(rdata, to); |
3051 | } | 3051 | } |
3052 | 3052 | /* if there was a short read -- discard anything left */ | |
3053 | if (rdata->got_bytes && rdata->got_bytes < rdata->bytes) | ||
3054 | rc = -ENODATA; | ||
3053 | } | 3055 | } |
3054 | list_del_init(&rdata->list); | 3056 | list_del_init(&rdata->list); |
3055 | kref_put(&rdata->refcount, cifs_uncached_readdata_release); | 3057 | kref_put(&rdata->refcount, cifs_uncached_readdata_release); |