summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2014-08-20 19:39:28 +0900
committerSteve French <smfrench@gmail.com>2014-08-21 12:04:29 -0500
commit27b7edcf1ce03a3eddda24d4d271a9b29572a78b (patch)
treebec2313230f2d09a4c9dd82c4656deee9d4bfb27
parent2bb93d244157b6dfa4964d4088be4680b3169701 (diff)
downloadop-kernel-dev-27b7edcf1ce03a3eddda24d4d271a9b29572a78b.zip
op-kernel-dev-27b7edcf1ce03a3eddda24d4d271a9b29572a78b.tar.gz
cifs: fix a possible null pointer deref in decode_ascii_ssetup
When kzalloc fails, we will end up doing NULL pointer derefrence Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r--fs/cifs/sess.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 39ee326..3a5e833 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -243,10 +243,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
kfree(ses->serverOS);
ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
- if (ses->serverOS)
+ if (ses->serverOS) {
strncpy(ses->serverOS, bcc_ptr, len);
- if (strncmp(ses->serverOS, "OS/2", 4) == 0)
- cifs_dbg(FYI, "OS/2 server\n");
+ if (strncmp(ses->serverOS, "OS/2", 4) == 0)
+ cifs_dbg(FYI, "OS/2 server\n");
+ }
bcc_ptr += len + 1;
bleft -= len + 1;
OpenPOWER on IntegriCloud