Message ID | 20201207082008.132263-1-bjorn.topel@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 3546b9b8eced9799b35ef953f766a0973b17fda2 |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next] xsk: Validate socket state in xsk_recvmsg, prior touching socket members | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Mon, Dec 7, 2020 at 9:22 AM Björn Töpel <bjorn.topel@gmail.com> wrote: > > From: Björn Töpel <bjorn.topel@intel.com> > > In AF_XDP the socket state needs to be checked, prior touching the > members of the socket. This was not the case for the recvmsg > implementation. Fix that by moving the xsk_is_bound() call. > > Reported-by: kernel test robot <oliver.sang@intel.com> > Fixes: 45a86681844e ("xsk: Add support for recvmsg()") > Signed-off-by: Björn Töpel <bjorn.topel@intel.com> > --- > net/xdp/xsk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c > index 56c46e5f57bc..e28c6825e089 100644 > --- a/net/xdp/xsk.c > +++ b/net/xdp/xsk.c > @@ -554,12 +554,12 @@ static int xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, int fl > struct sock *sk = sock->sk; > struct xdp_sock *xs = xdp_sk(sk); > > + if (unlikely(!xsk_is_bound(xs))) > + return -ENXIO; > if (unlikely(!(xs->dev->flags & IFF_UP))) > return -ENETDOWN; > if (unlikely(!xs->rx)) > return -ENOBUFS; > - if (unlikely(!xsk_is_bound(xs))) > - return -ENXIO; > if (unlikely(need_wait)) > return -EOPNOTSUPP; > > > base-commit: 34da87213d3ddd26643aa83deff7ffc6463da0fc > -- > 2.27.0 >
Hello: This patch was applied to bpf/bpf-next.git (refs/heads/master): On Mon, 7 Dec 2020 09:20:08 +0100 you wrote: > From: Björn Töpel <bjorn.topel@intel.com> > > In AF_XDP the socket state needs to be checked, prior touching the > members of the socket. This was not the case for the recvmsg > implementation. Fix that by moving the xsk_is_bound() call. > > Reported-by: kernel test robot <oliver.sang@intel.com> > Fixes: 45a86681844e ("xsk: Add support for recvmsg()") > Signed-off-by: Björn Töpel <bjorn.topel@intel.com> > > [...] Here is the summary with links: - [bpf-next] xsk: Validate socket state in xsk_recvmsg, prior touching socket members https://git.kernel.org/bpf/bpf-next/c/3546b9b8eced You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 56c46e5f57bc..e28c6825e089 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -554,12 +554,12 @@ static int xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, int fl struct sock *sk = sock->sk; struct xdp_sock *xs = xdp_sk(sk); + if (unlikely(!xsk_is_bound(xs))) + return -ENXIO; if (unlikely(!(xs->dev->flags & IFF_UP))) return -ENETDOWN; if (unlikely(!xs->rx)) return -ENOBUFS; - if (unlikely(!xsk_is_bound(xs))) - return -ENXIO; if (unlikely(need_wait)) return -EOPNOTSUPP;