diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-13 18:22:53 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-06-30 02:04:08 -0400 |
commit | 43727da90ec8955f1351ad582c6bc8f1c1ab8ab8 (patch) | |
tree | 64323d3cdb524b5d17383508cb124adb6b85d094 | |
parent | aa47cc1c3c7bd0df82b241aa2e3df36977b0c24b (diff) | |
download | linux-43727da90ec8955f1351ad582c6bc8f1c1ab8ab8.tar.bz2 |
do_ipv6_setsockopt(): don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 11 |
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 */ |