Skip to contentSkip to conversation

CIFS: check for granted memory

PATCH New Cyrill Gorcunov 1 participant 1 message Aug 17, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: check for granted memory

This patch adds just a check for granted memory
to prevent possible NULL pointer usage.

---

 fs/cifs/sess.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/cifs/sess.c +4 -0
index 2ea027d..892be9b 100644
@@ -372,6 +372,10 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
 
 	/* 2000 big enough to fit max user, domain, NOS name etc. */
 	str_area = kmalloc(2000, GFP_KERNEL);
+	if (str_area == NULL) {
+		cifs_small_buf_release(smb_buf);
+		return -ENOMEM;
+	}
 	bcc_ptr = str_area;
 
 	ses->flags &= ~CIFS_SES_LANMAN;