Patchwork cifs: potential NULL dereference in parse_DFS_referrals()

login
register
mail settings
Submitter roel kluin
Date Aug. 31, 2009, 1:28 p.m.
Message ID <4A9BD01B.4080405@gmail.com>
Download mbox | patch
Permalink /patch/53735/
State New
Headers show

Comments

roel kluin - Aug. 31, 2009, 1:28 p.m.
allocation may fail, prevent a NULL dereference.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---

Patch

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index b195773..7ea3240 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3963,6 +3963,10 @@  parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
 						GFP_KERNEL);
 			cifsConvertToUCS((__le16 *) tmp, searchName,
 					PATH_MAX, nls_codepage, remap);
+			if (tmp == NULL) {
+				rc = -ENOMEM;
+				goto parse_DFS_referrals_exit;
+			}
 			node->path_consumed = cifs_ucs2_bytes(tmp,
 					le16_to_cpu(pSMBr->PathConsumed),
 					nls_codepage);