* [Patch net] kcm: return immediately after copy_from_user() failure
@ 2017-03-23 18:03 Cong Wang
2017-03-24 20:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2017-03-23 18:03 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, Tom Herbert
There is no reason to continue after a copy_from_user()
failure.
Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/kcm/kcmsock.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 309062f..31762f7 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -1687,7 +1687,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
struct kcm_attach info;
if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
- err = -EFAULT;
+ return -EFAULT;
err = kcm_attach_ioctl(sock, &info);
@@ -1697,7 +1697,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
struct kcm_unattach info;
if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
- err = -EFAULT;
+ return -EFAULT;
err = kcm_unattach_ioctl(sock, &info);
@@ -1708,7 +1708,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
struct socket *newsock = NULL;
if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
- err = -EFAULT;
+ return -EFAULT;
err = kcm_clone(sock, &info, &newsock);
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch net] kcm: return immediately after copy_from_user() failure
2017-03-23 18:03 [Patch net] kcm: return immediately after copy_from_user() failure Cong Wang
@ 2017-03-24 20:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-03-24 20:14 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, tom
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 23 Mar 2017 11:03:31 -0700
> There is no reason to continue after a copy_from_user()
> failure.
>
> Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
> Cc: Tom Herbert <tom@herbertland.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied and queued up for -stable and this bug could make the kernel
use uninitialized on-stack data.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-24 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 18:03 [Patch net] kcm: return immediately after copy_from_user() failure Cong Wang
2017-03-24 20:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).