summaryrefslogtreecommitdiffstats
path: root/net/kcm
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2017-03-23 11:03:31 -0700
committerDavid S. Miller <davem@davemloft.net>2017-03-24 13:13:53 -0700
commita80db69e47d764bbcaf2fec54b1f308925e7c490 (patch)
tree3ea517edcaa774dc86f59f34d11699a4ef75a355 /net/kcm
parenta5af83925363eb85d467933e3d6ec5a87001eb7c (diff)
downloadlinux-a80db69e47d764bbcaf2fec54b1f308925e7c490.tar.gz
linux-a80db69e47d764bbcaf2fec54b1f308925e7c490.tar.bz2
linux-a80db69e47d764bbcaf2fec54b1f308925e7c490.zip
kcm: return immediately after copy_from_user() failure
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/kcm')
-rw-r--r--net/kcm/kcmsock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 309062f3debe..31762f76cdb5 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);