diff mbox

soreuseport: add compat case for setsockopt SO_ATTACH_REUSEPORT_CBPF

Message ID 20160603171805.GA3664@ls3530.box (mailing list archive)
State Superseded
Headers show

Commit Message

Helge Deller June 3, 2016, 5:18 p.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sergei Shtylyov June 3, 2016, 6:11 p.m. UTC | #1
Hello.

On 06/03/2016 08:18 PM, Helge Deller wrote:

> Commit 538950a ("soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF")

    At least 12 digits must be specified for SHA1. checkpatch.pl should've 
caught this.

> 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)

    You need to realign this line now.

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Helge Deller June 3, 2016, 9:09 p.m. UTC | #2
On 03.06.2016 20:11, Sergei Shtylyov wrote:
> Hello.
> 
> On 06/03/2016 08:18 PM, Helge Deller wrote:
> 
>> Commit 538950a ("soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF")
> 
>    At least 12 digits must be specified for SHA1. checkpatch.pl should've caught this.

Ok.

>> 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)
> 
>    You need to realign this line now.

Sure, I will send an updated patch.

Any idea for a better naming than "do_sockopt_fix_sock_fprog()" ?

Helge
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);