summaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-05-13 18:22:53 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-06-30 02:04:08 -0400
commit43727da90ec8955f1351ad582c6bc8f1c1ab8ab8 (patch)
tree64323d3cdb524b5d17383508cb124adb6b85d094 /net/ipv6
parentaa47cc1c3c7bd0df82b241aa2e3df36977b0c24b (diff)
downloadlinux-43727da90ec8955f1351ad582c6bc8f1c1ab8ab8.tar.gz
linux-43727da90ec8955f1351ad582c6bc8f1c1ab8ab8.tar.bz2
linux-43727da90ec8955f1351ad582c6bc8f1c1ab8ab8.zip
do_ipv6_setsockopt(): don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/ipv6')
-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 */