From: Paolo Abeni Date: Wed, 23 Aug 2017 09:57:51 +0000 (+0200) Subject: net/sock: allow the user to set negative peek offset X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=257a73031d29447ee82fe06d2b97d8564f63276d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net/sock: allow the user to set negative peek offset This is necessary to allow the user to disable peeking with offset once it's enabled. Unix sockets already allow the above, with this patch we permit it for udp[6] sockets, too. Fixes: 627d2d6b5500 ("udp: enable MSG_PEEK at non-zero offset") Signed-off-by: Paolo Abeni Acked-by: Willem de Bruijn Signed-off-by: David S. Miller --- diff --git a/net/core/sock.c b/net/core/sock.c index 0f04d8bff607..dfdd14cac775 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2454,9 +2454,6 @@ EXPORT_SYMBOL(__sk_mem_reclaim); int sk_set_peek_off(struct sock *sk, int val) { - if (val < 0) - return -EINVAL; - sk->sk_peek_off = val; return 0; }