Thread (14 messages) 14 messages, 4 authors, 2017-02-14

RE: [PATCH V5 3/4] Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN

flat view

From: David Laight <hidden>
Date: 2017-02-13 17:08:12
Also in: linux-nvme, lkml

From: Arnd Bergmann
Sent: 13 February 2017 17:02
...
quoted
quoted
quoted
+   ioctl_ptr = memdup_user(arg,  _IOC_SIZE(cmd));
+   if (IS_ERR_OR_NULL(ioctl_ptr)) {
+           ret = PTR_ERR(ioctl_ptr);
+           goto out;
...
quoted
+ out:
+   kfree(ioctl_ptr);
+   return ret;
...
quoted
quoted
That error path doesn't look quite right to me.
...
quoted
good god, this is a mess this morning. Thanks for the catch, I'll review these
more aggressively before sending out.
memdup_user() never returns NULL, and generally speaking any use of
IS_ERR_OR_NULL() indicates that there is something wrong with the
interface, so aside from passing the right pointer (or NULL) into kfree()
I think using IS_ERR() is the correct solution.
You missed the problem entirely.
Code needs to be:
	if (IS_ERR(ioctl_ptr))
		return PTR_ERR(ioctl_ptr);

	David

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help