Skip to content

Commit 936322a

Browse files
committed
Merge: CVE-2025-21669: vsock/virtio: discard packets if the transport changes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6318 JIRA: https://issues.redhat.com/browse/RHEL-77228 CVE: CVE-2025-21669 ``` vsock/virtio: discard packets if the transport changes If the socket has been de-assigned or assigned to another transport, we must discard any packets received because they are not expected and would cause issues when we access vsk->transport. A possible scenario is described by Hyunwoo Kim in the attached link, where after a first connect() interrupted by a signal, and a second connect() failed, we can find `vsk->transport` at NULL, leading to a NULL pointer dereference. Fixes: c0cfa2d ("vsock: add multi-transports support") Cc: stable@vger.kernel.org Reported-by: Hyunwoo Kim <v4bel@theori.io> Reported-by: Wongi Lee <qwerty@theori.io> Closes: https://lore.kernel.org/netdev/Z2LvdTTQR7dBmPb5@v4bel-B760M-AORUS-ELITE-AX/ Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Hyunwoo Kim <v4bel@theori.io> Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 2cb7c75) ``` Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> --- <small>Created 2025-01-31 18:41 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://gitlab.com/cki-project/kernel-workflow/-/issues/new?issue%5Btitle%5D=backporter%20webhook%20issue)</small> Approved-by: Stefano Garzarella <sgarzare@redhat.com> Approved-by: Luigi Leonardi <leonardi@redhat.com> Approved-by: Stefan Hajnoczi <stefanha@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Patrick Talbert <ptalbert@redhat.com>
2 parents 25be68b + 0b3993b commit 936322a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/vmw_vsock/virtio_transport_common.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,8 +1578,11 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,
15781578

15791579
lock_sock(sk);
15801580

1581-
/* Check if sk has been closed before lock_sock */
1582-
if (sock_flag(sk, SOCK_DONE)) {
1581+
/* Check if sk has been closed or assigned to another transport before
1582+
* lock_sock (note: listener sockets are not assigned to any transport)
1583+
*/
1584+
if (sock_flag(sk, SOCK_DONE) ||
1585+
(sk->sk_state != TCP_LISTEN && vsk->transport != &t->transport)) {
15831586
(void)virtio_transport_reset_no_sock(t, skb);
15841587
release_sock(sk);
15851588
sock_put(sk);

0 commit comments

Comments
 (0)