mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 14:45:27 +00:00
vsock/bpf: Warn on socket without transport
In the spirit of commit 91751e248256 ("vsock: prevent null-ptr-deref in vsock_*[has_data|has_space]"), armorize the "impossible" cases with a warning. Fixes: 634f1a7110b4 ("vsock: support sockmap") Signed-off-by: Michal Luczaj <mhal@rbox.co> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
8fb5bb169d
commit
857ae05549
@ -1189,6 +1189,9 @@ static int vsock_read_skb(struct sock *sk, skb_read_actor_t read_actor)
|
||||
{
|
||||
struct vsock_sock *vsk = vsock_sk(sk);
|
||||
|
||||
if (WARN_ON_ONCE(!vsk->transport))
|
||||
return -ENODEV;
|
||||
|
||||
return vsk->transport->read_skb(vsk, read_actor);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ static int vsock_bpf_recvmsg(struct sock *sk, struct msghdr *msg,
|
||||
lock_sock(sk);
|
||||
vsk = vsock_sk(sk);
|
||||
|
||||
if (!vsk->transport) {
|
||||
if (WARN_ON_ONCE(!vsk->transport)) {
|
||||
copied = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user