aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2009-08-31 15:27:26 +0000
committerSteve French <sfrench@us.ibm.com>2009-08-31 15:27:26 +0000
commit2920ee2b47fc8e6aebe1d1956b2725f48fa93cc5 (patch)
treed6c65477946df8f136800e813da52df55e65919c /fs/cifs/cifssmb.c
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 (diff)
downloadlinux-dev-2920ee2b47fc8e6aebe1d1956b2725f48fa93cc5.tar.xz
linux-dev-2920ee2b47fc8e6aebe1d1956b2725f48fa93cc5.zip
[CIFS] potential NULL dereference in parse_DFS_referrals()
memory allocation may fail, prevent a NULL dereference Pointed out by Roel Kluin CC: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 1866bc2927d4..5f0b80d39923 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3961,6 +3961,10 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
if (is_unicode) {
__le16 *tmp = kmalloc(strlen(searchName)*2 + 2,
GFP_KERNEL);
+ if (tmp == NULL) {
+ rc = -ENOMEM;
+ goto parse_DFS_referrals_exit;
+ }
cifsConvertToUCS((__le16 *) tmp, searchName,
PATH_MAX, nls_codepage, remap);
node->path_consumed = cifs_ucs2_bytes(tmp,