lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161124111204.GH17225@mwanda>
Date:   Thu, 24 Nov 2016 14:12:04 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Oleg Drokin <oleg.drokin@...el.com>
Cc:     Andreas Dilger <andreas.dilger@...el.com>,
        James Simmons <jsimmons@...radead.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Liang Zhen <liang.zhen@...el.com>,
        Vitaly Fertman <vitaly_fertman@...atex.com>,
        frank zago <fzago@...y.com>,
        Sebastien Buisson <sebastien.buisson@...l.net>,
        Amir Shehata <amir.shehata@...el.com>,
        Niu Yawei <yawei.niu@...el.com>, lustre-devel@...ts.lustre.org,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: [patch] staging: lustre/ptlrpc:  small leak on allocation failure

We should free "desc" before returning NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index ac959ef..8047413 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -128,12 +128,12 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
 		GET_KIOV(desc) = kcalloc(nfrags, sizeof(*GET_KIOV(desc)),
 					 GFP_NOFS);
 		if (!GET_KIOV(desc))
-			goto out;
+			goto free_desc;
 	} else {
 		GET_KVEC(desc) = kcalloc(nfrags, sizeof(*GET_KVEC(desc)),
 					 GFP_NOFS);
 		if (!GET_KVEC(desc))
-			goto out;
+			goto free_desc;
 	}
 
 	spin_lock_init(&desc->bd_lock);
@@ -154,7 +154,8 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned int nfrags,
 		LNetInvalidateHandle(&desc->bd_mds[i]);
 
 	return desc;
-out:
+free_desc:
+	kfree(desc);
 	return NULL;
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ