diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2014-07-10 10:21:15 +0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2014-07-14 23:20:08 -0500 |
commit | 94ec93ce601b5cb65a9216a926098855fb879a33 (patch) | |
tree | fb021e814ff509fe5304069de618f85a5ab10253 /fs/cifs | |
parent | 3bb56240b694438342afd07d10e11859fb39a6e7 (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 f6cb7650e452..2927f02beb7c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3048,7 +3048,9 @@ again: } else { rc = cifs_readdata_to_iov(rdata, to); } - + /* if there was a short read -- discard anything left */ + if (rdata->got_bytes && rdata->got_bytes < rdata->bytes) + rc = -ENODATA; } list_del_init(&rdata->list); kref_put(&rdata->refcount, cifs_uncached_readdata_release); |