summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-05-14 01:22:53 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2017-06-30 09:04:08 +0300
commit43727da90ec8955f1351ad582c6bc8f1c1ab8ab8 (patch)
tree64323d3cdb524b5d17383508cb124adb6b85d094 /net
parentaa47cc1c3c7bd0df82b241aa2e3df36977b0c24b (diff)
downloadlinux-43727da90ec8955f1351ad582c6bc8f1c1ab8ab8.tar.xz
do_ipv6_setsockopt(): don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/ipv6_sockglue.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index a531ba032b85..f8298c9a3160 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -735,14 +735,9 @@ done:
retv = -ENOBUFS;
break;
}
- gsf = kmalloc(optlen, GFP_KERNEL);
- if (!gsf) {
- retv = -ENOBUFS;
- break;
- }
- retv = -EFAULT;
- if (copy_from_user(gsf, optval, optlen)) {
- kfree(gsf);
+ gsf = memdup_user(optval, optlen);
+ if (IS_ERR(gsf)) {
+ retv = PTR_ERR(gsf);
break;
}
/* numsrc >= (4G-140)/128 overflow in 32 bits */