summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-16 20:15:25 +0400
committerSteve French <sfrench@us.ibm.com>2010-08-02 12:40:39 +0000
commitf55fdcca6bf1c17e86a270a8c0d81c6677c61222 (patch)
treeee005fcd546b472375c5fb6c84929f1a1ce5d0e4
parent0ccd48025fe64cf01782ba3c7037654d25bd1950 (diff)
fs: cifs: check kmalloc() result
If kmalloc() fails exit with -ENOMEM. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/readdir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index daf1753af674..d5e591fab475 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -847,6 +847,11 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len;
tmp_buf = kmalloc(UNICODE_NAME_MAX, GFP_KERNEL);
+ if (tmp_buf == NULL) {
+ rc = -ENOMEM;
+ break;
+ }
+
for (i = 0; (i < num_to_fill) && (rc == 0); i++) {
if (current_entry == NULL) {
/* evaluate whether this case is an error */