Skip to contentSkip to conversation

CIFS: memory leakage at ./fs/cifs/cifsencrypt.c

PATCH New iceberg 1 participant 1 message Aug 11, 2009

lore
Share & tools
lore

iceberg

author
#0 lore raw

PATCH 1/1 CIFS: memory leakage at ./fs/cifs/cifsencrypt.c

in function calc_ntlmv2_hash memory is not released.
1. If in the line 333 we successfully allocate memory and assign it to pctxt variable:

        pctxt = kmalloc(sizeof(struct HMACMD5Context), GFP_KERNEL);

then we go to line 376 and exit wihout releasing memory pointed to by pctxt variable.

Add a memory releasing for pctxt variable before exit from function calc_ntlmv2_hash.

---

b/fs/cifs/cifsencrypt.c renamed from a/fs/cifs/cifsencrypt.c +1 -0
index 7c98095..7efe174 100644
@@ -373,6 +373,7 @@ calc_exit_2:
           compare with the NTLM example */
        hmac_md5_final(ses->server->ntlmv2_hash, pctxt);
 
+       kfree(pctxt);
        return rc;
 }