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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 21 Mar 2015 13:13:59 -0400
From:	Sanidhya Kashyap <sanidhya.gatech@...il.com>
To:	dhowells@...hat.com, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc:	taesoo@...ech.edu, changwoo@...ech.edu, sanidhya@...ech.edu,
	blee@...ech.edu, Sanidhya Kashyap <sanidhya.gatech@...il.com>
Subject: [PATCH] afs: kstrdup() memory handling

Handling kstrdup() failure in case of memory pressure even
for new_opts.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@...il.com>
---
 fs/afs/super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index c486155..477f38e 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -360,10 +360,13 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
 	struct key *key;
 	char *new_opts = kstrdup(options, GFP_KERNEL);
 	struct afs_super_info *as;
-	int ret;
+	int ret = -ENOMEM;
 
 	_enter(",,%s,%p", dev_name, options);
 
+	if (!new_opts)
+		goto error_out;
+
 	memset(&params, 0, sizeof(params));
 
 	ret = -EINVAL;
@@ -441,6 +444,7 @@ error:
 	afs_put_cell(params.cell);
 	key_put(params.key);
 	kfree(new_opts);
+error_out:
 	_leave(" = %d", ret);
 	return ERR_PTR(ret);
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ