netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soreuseport: add compat case for setsockopt SO_ATTACH_REUSEPORT_CBPF
@ 2016-06-03 17:18 Helge Deller
  2016-06-03 18:11 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Helge Deller @ 2016-06-03 17:18 UTC (permalink / raw)
  To: Craig Gallek, Alexei Starovoitov, David S. Miller, netdev; +Cc: linux-parisc

Commit 538950a ("soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF")
missed to add the compat case for the SO_ATTACH_REUSEPORT_CBPF
setsockoption() option.

Since both SO_ATTACH_FILTER and SO_ATTACH_REUSEPORT_CBPF use a struct
sock_fprog let's combine the handling of both.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/net/compat.c b/net/compat.c
index 5cfd26a..7e2aac9 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -309,7 +309,7 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
 	__scm_destroy(scm);
 }
 
-static int do_set_attach_filter(struct socket *sock, int level, int optname,
+static int do_sockopt_fix_sock_fprog(struct socket *sock, int level, int optname,
 				char __user *optval, unsigned int optlen)
 {
 	struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
@@ -354,8 +354,9 @@ static int do_set_sock_timeout(struct socket *sock, int level,
 static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
 				char __user *optval, unsigned int optlen)
 {
-	if (optname == SO_ATTACH_FILTER)
-		return do_set_attach_filter(sock, level, optname,
+	if (optname == SO_ATTACH_FILTER ||
+	    optname == SO_ATTACH_REUSEPORT_CBPF)
+		return do_sockopt_fix_sock_fprog(sock, level, optname,
 					    optval, optlen);
 	if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
 		return do_set_sock_timeout(sock, level, optname, optval, optlen);

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH] soreuseport: add compat case for setsockopt SO_ATTACH_REUSEPORT_CBPF
@ 2016-06-03 21:33 Craig Gallek
  2016-06-03 21:40 ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Craig Gallek @ 2016-06-03 21:33 UTC (permalink / raw)
  To: Helge Deller
  Cc: Sergei Shtylyov, Alexei Starovoitov, David S. Miller,
	netdev@vger.kernel.org, linux-parisc@vger.kernel.org

On Fri, Jun 3, 2016 at 5:09 PM, Helge Deller <deller@gmx.de> wrote:
> Any idea for a better naming than "do_sockopt_fix_sock_fprog()" ?
Thanks for catching and fixing this.  I'd suggest simply leaving the
function name as-is.  Your fix to the condition in that function is
sufficient to address the issue.

Craig

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-03 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03 17:18 [PATCH] soreuseport: add compat case for setsockopt SO_ATTACH_REUSEPORT_CBPF Helge Deller
2016-06-03 18:11 ` Sergei Shtylyov
2016-06-03 21:09   ` Helge Deller
  -- strict thread matches above, loose matches on Subject: below --
2016-06-03 21:33 Craig Gallek
2016-06-03 21:40 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).