Skip to content

Commit

Permalink
kcm: return immediately after copy_from_user() failure
Browse files Browse the repository at this point in the history
There is no reason to continue after a copy_from_user()
failure.

Fixes: ab7ac4e ("kcm: Kernel Connection Multiplexor module")
Cc: Tom Herbert <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
congwang authored and davem330 committed Mar 24, 2017
1 parent a5af839 commit a80db69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/kcm/kcmsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit a80db69

Please sign in to comment.