mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 11:06:41 -05:00
vsock/bpf: Warn on socket without transport
In the spirit of commit91751e2482("vsock: prevent null-ptr-deref in vsock_*[has_data|has_space]"), armorize the "impossible" cases with a warning. Fixes:634f1a7110("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:
committed by
Paolo Abeni
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user