# \[PATCH net\] bpf: fix bpf\_setsockopts return value

- Subsystems: BPF \[GENERAL\] (Safe Dynamic Programs and Tools), BPF \[NETWORKING\] (tcx \& tc BPF, sock\_addr), NETWORKING \[GENERAL\], THE REST
- Maintainers: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
- Status: REVIEWED: 2 (1M) (M Neal Cardwell Craig Gallek)
- Reviewed.
- 2 review trailers.
- List: netdev
- 4 messages, 4 authors
- Page: https://ratatoskr.run/netdev/2017/08/11064034/t

## \[PATCH net\] bpf: fix bpf\_setsockopts return value

- From: Yuchung Cheng \<hidden\>
- Date: 2017-08-24 22:48:34 
- Message: https://ratatoskr.run/netdev/2017/08/11064034.md

```text
This patch fixes a bug causing any sock operations to always return EINVAL.

Fixes: a5192c52377e ("bpf: fix to bpf_setsockops").
Reported-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <redacted>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Craig Gallek <redacted>
---
 net/core/filter.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 6280a602604c..8eb81e5fae08 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2872,7 +2872,6 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
 				ret = -EINVAL;
 			}
 		}
-		ret = -EINVAL;
 #endif
 	} else {
 		ret = -EINVAL;
-- 
2.14.1.342.g6490525c54-goog
```

## Re: \[PATCH net\] bpf: fix bpf\_setsockopts return value

- From: Daniel Borkmann \<daniel@iogearbox.net\>
- Date: 2017-08-24 23:37:13 
- Message: https://ratatoskr.run/netdev/2017/08/11064038.md

```text
On 08/25/2017 12:48 AM, Yuchung Cheng wrote:
> This patch fixes a bug causing any sock operations to always return EINVAL.
>
> Fixes: a5192c52377e ("bpf: fix to bpf_setsockops").
> Reported-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <redacted>
> Acked-by: Neal Cardwell <ncardwell@google.com>
> Acked-by: Craig Gallek <redacted>

Ohh well, thanks for the fix!

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
```

## Re: \[PATCH net\] bpf: fix bpf\_setsockopts return value

- From: Lawrence Brakmo \<hidden\>
- Date: 2017-08-24 23:45:44 
- Message: https://ratatoskr.run/netdev/2017/08/11064039.md

```text


On 8/24/17, 4:37 PM, "Daniel Borkmann" [ref] wrote:

    On 08/25/2017 12:48 AM, Yuchung Cheng wrote:
    > This patch fixes a bug causing any sock operations to always return EINVAL.
    >
    > Fixes: a5192c52377e ("bpf: fix to bpf_setsockops").
    > Reported-by: Neal Cardwell [ref]
    > Signed-off-by: Yuchung Cheng [ref]
    > Acked-by: Neal Cardwell [ref]
    > Acked-by: Craig Gallek [ref]
    
    Ohh well, thanks for the fix!
    
    Acked-by: Daniel Borkmann [ref]

Thanks! I never checked return values in by bpf test programs

Acked-by: Lawrence Brakmo <redacted> 
   

```

## Re: \[PATCH net\] bpf: fix bpf\_setsockopts return value

- From: David Miller \<davem@davemloft.net\>
- Date: 2017-08-25 01:24:18 
- Message: https://ratatoskr.run/netdev/2017/08/11064053.md

```text
From: Yuchung Cheng <redacted>
Date: Thu, 24 Aug 2017 15:48:21 -0700

> This patch fixes a bug causing any sock operations to always return EINVAL.
> 
> Fixes: a5192c52377e ("bpf: fix to bpf_setsockops").
> Reported-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <redacted>
> Acked-by: Neal Cardwell <ncardwell@google.com>
> Acked-by: Craig Gallek <redacted>

Applied.
```
