Skip to content

Conversation

@shreeya-patel98
Copy link
Collaborator

Commits

    vsock: Fix transport_* TOCTOU
    
    jira VULN-80686
    cve CVE-2025-38461
    commit-author Michal Luczaj <[email protected]>
    commit 687aa0c5581b8d4aa87fd92973e4ee576b550cdf
    

    i40e: fix MMIO write access to an invalid page in i40e_clear_hw
    
    jira VULN-72066
    cve CVE-2025-38200
    commit-author Kyungwook Boo <[email protected]>
    commit 015bac5daca978448f2671478c553ce1f300c21e
 
    

    sch_hfsc: make hfsc_qlen_notify() idempotent
    
    jira VULN-71951
    cve CVE-2025-38177
    commit-author Cong Wang <[email protected]>
    commit 51eb3b65544c9efd6a1026889ee5fb5aa62da3bb
    
    wifi: rtw88: fix the 'para' buffer size to avoid reading out of bounds
    
    jira VULN-71890
    cve CVE-2025-38159
    commit-author Alexey Kodanev <[email protected]>
    commit 4c2c372de2e108319236203cce6de44d70ae15cd

    net: ch9200: fix uninitialised access during mii_nway_restart
    
    jira VULN-71596
    cve CVE-2025-38086
    commit-author Qasim Ijaz <[email protected]>
    commit 9ad0452c0277b816a435433cca601304cfac7c21    
    crypto: algif_hash - fix double free in hash_accept
    
    jira VULN-70981
    cve CVE-2025-38079
    commit-author Ivan Pravdin <[email protected]>
    commit b2df03ed4052e97126267e8c13ad4204ea6ba9b6
    

    net_sched: ets: Fix double list add in class with netem as child qdisc
    
    jira VULN-73375
    cve CVE-2025-37914
    commit-author Victor Nogueira <[email protected]>
    commit 1a6d0c00fa07972384b0c308c72db091d49988b6
    
    net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too
    
    jira VULN-67738
    cve CVE-2025-37823
    commit-author Cong Wang <[email protected]>
    commit 6ccbda44e2cc3d26fd22af54c650d6d5d801addf

    usb: dwc3: gadget: check that event count does not exceed event buffer length
    
    jira VULN-67719
    cve CVE-2025-37810
    commit-author Frode Isaksen <[email protected]>
    commit 63ccd26cd1f6600421795f6ca3e625076be06c9f
    

    net_sched: hfsc: Fix a UAF vulnerability in class handling
    
    jira VULN-67702
    cve CVE-2025-37797
    commit-author Cong Wang <[email protected]>
    commit 3df275ef0a6ae181e8428a6589ef5d5231e58b5c
    

Kernel Build Log

[shreeya@localhost kernel-src-tree]$ ../kernel-src-tree-tools/kernel_build.sh -m 2>&1 | tee ../kernel-build.log
/mnt/scratch/workspace/fips-9-compliant/kernel-src-tree
Skipping make mrproper
[TIMER]{MRPROPER}: 0s
x86_64 architecture detected, copying config
'configs/kernel-x86_64-rhel.config' -> '.config'
Setting Local Version for build
CONFIG_LOCALVERSION="-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965"
Making olddefconfig
#
# configuration written to .config
#
Starting Build
 SYNC    include/config/auto.conf.cmd
 UPD     include/config/kernel.release
 DESCEND objtool
 DESCEND bpf/resolve_btfids
 UPD     include/generated/utsrelease.h
 CALL    scripts/atomic/check-atomics.sh
warning: generated include/linux/atomic/atomic-instrumented.h has been modified.
 CALL    scripts/checksyscalls.sh
 CHK     include/generated/compile.h
 CC      init/version.o
 CC      arch/x86/crypto/aesni-intel_glue.o
 AR      init/built-in.a
 CC      kernel/sys.o
 CC [M]  net/bridge/br_device.o
 CC [M]  net/bridge/br_forward.o
 AR      arch/x86/crypto/built-in.a
 CC [M]  net/l2tp/l2tp_core.o
 CC      crypto/fips.o
 CC      security/integrity/ima/ima_init.o
 CC      crypto/algapi.o
 CC [M]  net/bridge/br_if.o
 AR      arch/x86/built-in.a
 AR      security/integrity/ima/built-in.a
 AR      security/integrity/built-in.a
 AR      security/built-in.a
 <--snip-->
 STRIP   /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/usb/snd-usb-audio.ko
 INSTALL /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/xen/snd_xen_front.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/usb/misc/snd-ua101.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/usb/usx2y/snd-usb-us122l.ko
 STRIP   /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/x86/snd-hdmi-lpe-audio.ko
 STRIP   /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/xen/snd_xen_front.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/virtio/virtio_snd.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/usb/snd-usb-audio.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/x86/snd-hdmi-lpe-audio.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/sound/xen/snd_xen_front.ko
 SIGN    /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+/kernel/drivers/net/ipvlan/ipvtap.ko
 DEPMOD  /lib/modules/5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+
[TIMER]{MODULES}: 10s
Making Install
sh ./arch/x86/boot/install.sh \
   5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-169ee76f6965+ arch/x86/boot/bzImage \
   System.map "/boot"
[TIMER]{INSTALL}: 21s
Checking kABI
kABI check passed
Setting Default Kernel to /boot/vmlinuz-5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-f5000b080a7e+ and Index to 4
The default is /boot/loader/entries/809410938d1447fc931cf787fb714082-5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-f5000b080a7e+.conf with index 4 and kernel /boot/vmlinuz-5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-f5000b080a7e+
The default is /boot/loader/entries/809410938d1447fc931cf787fb714082-5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-f5000b080a7e+.conf with index 4 and kernel /boot/vmlinuz-5.14.0-shreeya_fips-9-compliant_5.14.0-284.30.1-f5000b080a7e+
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
Hopefully Grub2.0 took everything ... rebooting after time metrices
[TIMER]{MRPROPER}: 0s
[TIMER]{BUILD}: 271s
[TIMER]{MODULES}: 10s
[TIMER]{INSTALL}: 21s
[TIMER]{TOTAL} 305s
Rebooting in 10 seconds

kernel-build.log

Testing

shreeya@spatel-dev-bom ~/c/w/fips-9-compliant> grep -a ^ok kselftest-before.log | wc -l
317
shreeya@spatel-dev-bom ~/c/w/fips-9-compliant> grep -a ^ok kselftest-after.log | wc -l
317

kselftest-after.log
kselftest-before.log

jira VULN-67702
cve CVE-2025-37797
commit-author Cong Wang <[email protected]>
commit 3df275e

This patch fixes a Use-After-Free vulnerability in the HFSC qdisc class
handling. The issue occurs due to a time-of-check/time-of-use condition
in hfsc_change_class() when working with certain child qdiscs like netem
or codel.

The vulnerability works as follows:
1. hfsc_change_class() checks if a class has packets (q.qlen != 0)
2. It then calls qdisc_peek_len(), which for certain qdiscs (e.g.,
   codel, netem) might drop packets and empty the queue
3. The code continues assuming the queue is still non-empty, adding
   the class to vttree
4. This breaks HFSC scheduler assumptions that only non-empty classes
   are in vttree
5. Later, when the class is destroyed, this can lead to a Use-After-Free

The fix adds a second queue length check after qdisc_peek_len() to verify
the queue wasn't emptied.

Fixes: 21f4d5c ("net_sched/hfsc: fix curve activation in hfsc_change_class()")
	Reported-by: Gerrard Tai <[email protected]>
	Reviewed-by: Konstantin Khlebnikov <[email protected]>
	Signed-off-by: Cong Wang <[email protected]>
	Reviewed-by: Jamal Hadi Salim <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 3df275e)
	Signed-off-by: Shreeya Patel <[email protected]>
…r length

jira VULN-67719
cve CVE-2025-37810
commit-author Frode Isaksen <[email protected]>
commit 63ccd26

The event count is read from register DWC3_GEVNTCOUNT.
There is a check for the count being zero, but not for exceeding the
event buffer length.
Check that event count does not exceed event buffer length,
avoiding an out-of-bounds access when memcpy'ing the event.
Crash log:
Unable to handle kernel paging request at virtual address ffffffc0129be000
pc : __memcpy+0x114/0x180
lr : dwc3_check_event_buf+0xec/0x348
x3 : 0000000000000030 x2 : 000000000000dfc4
x1 : ffffffc0129be000 x0 : ffffff87aad60080
Call trace:
__memcpy+0x114/0x180
dwc3_interrupt+0x24/0x34

	Signed-off-by: Frode Isaksen <[email protected]>
Fixes: 72246da ("usb: Introduce DesignWare USB3 DRD Driver")
	Cc: stable <[email protected]>
	Acked-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
	Signed-off-by: Greg Kroah-Hartman <[email protected]>
(cherry picked from commit 63ccd26)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-67738
cve CVE-2025-37823
commit-author Cong Wang <[email protected]>
commit 6ccbda4

Similarly to the previous patch, we need to safe guard hfsc_dequeue()
too. But for this one, we don't have a reliable reproducer.

Fixes: 1da177e ("Linux-2.6.12-rc2")
	Reported-by: Gerrard Tai <[email protected]>
	Signed-off-by: Cong Wang <[email protected]>
	Reviewed-by: Jamal Hadi Salim <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 6ccbda4)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-73375
cve CVE-2025-37914
commit-author Victor Nogueira <[email protected]>
commit 1a6d0c0

As described in Gerrard's report [1], there are use cases where a netem
child qdisc will make the parent qdisc's enqueue callback reentrant.
In the case of ets, there won't be a UAF, but the code will add the same
classifier to the list twice, which will cause memory corruption.

In addition to checking for qlen being zero, this patch checks whether
the class was already added to the active_list (cl_is_active) before
doing the addition to cater for the reentrant case.

[1] https://lore.kernel.org/netdev/CAHcdcOm+03OD2j6R0=YHKqmy=VgJ8xEOKuP6c7mSgnp-TEJJbw@mail.gmail.com/

Fixes: 37d9cf1 ("sched: Fix detection of empty queues in child qdiscs")
	Acked-by: Jamal Hadi Salim <[email protected]>
	Signed-off-by: Victor Nogueira <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 1a6d0c0)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-70981
cve CVE-2025-38079
commit-author Ivan Pravdin <[email protected]>
commit b2df03e

If accept(2) is called on socket type algif_hash with
MSG_MORE flag set and crypto_ahash_import fails,
sk2 is freed. However, it is also freed in af_alg_release,
leading to slab-use-after-free error.

Fixes: fe869cd ("crypto: algif_hash - User-space interface for hash operations")
	Cc: <[email protected]>
	Signed-off-by: Ivan Pravdin <[email protected]>
	Signed-off-by: Herbert Xu <[email protected]>
(cherry picked from commit b2df03e)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-71596
cve CVE-2025-38086
commit-author Qasim Ijaz <[email protected]>
commit 9ad0452

In mii_nway_restart() the code attempts to call
mii->mdio_read which is ch9200_mdio_read(). ch9200_mdio_read()
utilises a local buffer called "buff", which is initialised
with control_read(). However "buff" is conditionally
initialised inside control_read():

        if (err == size) {
                memcpy(data, buf, size);
        }

If the condition of "err == size" is not met, then
"buff" remains uninitialised. Once this happens the
uninitialised "buff" is accessed and returned during
ch9200_mdio_read():

        return (buff[0] | buff[1] << 8);

The problem stems from the fact that ch9200_mdio_read()
ignores the return value of control_read(), leading to
uinit-access of "buff".

To fix this we should check the return value of
control_read() and return early on error.

	Reported-by: syzbot <[email protected]>
Closes: https://syzkaller.appspot.com/bug?extid=3361c2d6f78a3e0892f9
	Tested-by: syzbot <[email protected]>
Fixes: 4a476bd ("usbnet: New driver for QinHeng CH9200 devices")
	Cc: [email protected]
	Signed-off-by: Qasim Ijaz <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 9ad0452)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-71890
cve CVE-2025-38159
commit-author Alexey Kodanev <[email protected]>
commit 4c2c372

Set the size to 6 instead of 2, since 'para' array is passed to
'rtw_fw_bt_wifi_control(rtwdev, para[0], &para[1])', which reads
5 bytes:

void rtw_fw_bt_wifi_control(struct rtw_dev *rtwdev, u8 op_code, u8 *data)
{
    ...
    SET_BT_WIFI_CONTROL_DATA1(h2c_pkt, *data);
    SET_BT_WIFI_CONTROL_DATA2(h2c_pkt, *(data + 1));
    ...
    SET_BT_WIFI_CONTROL_DATA5(h2c_pkt, *(data + 4));

Detected using the static analysis tool - Svace.
Fixes: 4136214 ("rtw88: add BT co-existence support")
	Signed-off-by: Alexey Kodanev <[email protected]>
	Signed-off-by: Ping-Ke Shih <[email protected]>
Link: https://patch.msgid.link/[email protected]
(cherry picked from commit 4c2c372)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-71951
cve CVE-2025-38177
commit-author Cong Wang <[email protected]>
commit 51eb3b6

hfsc_qlen_notify() is not idempotent either and not friendly
to its callers, like fq_codel_dequeue(). Let's make it idempotent
to ease qdisc_tree_reduce_backlog() callers' life:

1. update_vf() decreases cl->cl_nactive, so we can check whether it is
non-zero before calling it.

2. eltree_remove() always removes RB node cl->el_node, but we can use
   RB_EMPTY_NODE() + RB_CLEAR_NODE() to make it safe.

	Reported-by: Gerrard Tai <[email protected]>
	Signed-off-by: Cong Wang <[email protected]>
	Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Acked-by: Jamal Hadi Salim <[email protected]>
	Signed-off-by: Paolo Abeni <[email protected]>
(cherry picked from commit 51eb3b6)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-72066
cve CVE-2025-38200
commit-author Kyungwook Boo <[email protected]>
commit 015bac5

When the device sends a specific input, an integer underflow can occur, leading
to MMIO write access to an invalid page.

Prevent the integer underflow by changing the type of related variables.

	Signed-off-by: Kyungwook Boo <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/T/
	Reviewed-by: Przemek Kitszel <[email protected]>
	Reviewed-by: Simon Horman <[email protected]>
	Reviewed-by: Aleksandr Loktionov <[email protected]>
	Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel)
	Signed-off-by: Tony Nguyen <[email protected]>
(cherry picked from commit 015bac5)
	Signed-off-by: Shreeya Patel <[email protected]>
jira VULN-80686
cve CVE-2025-38461
commit-author Michal Luczaj <[email protected]>
commit 687aa0c

Transport assignment may race with module unload. Protect new_transport
from becoming a stale pointer.

This also takes care of an insecure call in vsock_use_local_transport();
add a lockdep assert.

BUG: unable to handle page fault for address: fffffbfff8056000
Oops: Oops: 0000 [#1] SMP KASAN
RIP: 0010:vsock_assign_transport+0x366/0x600
Call Trace:
 vsock_connect+0x59c/0xc40
 __sys_connect+0xe8/0x100
 __x64_sys_connect+0x6e/0xc0
 do_syscall_64+0x92/0x1c0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53

Fixes: c0cfa2d ("vsock: add multi-transports support")
	Reviewed-by: Stefano Garzarella <[email protected]>
	Signed-off-by: Michal Luczaj <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 687aa0c)
	Signed-off-by: Shreeya Patel <[email protected]>
@shreeya-patel98 shreeya-patel98 requested a review from a team October 24, 2025 17:37
@shreeya-patel98 shreeya-patel98 self-assigned this Oct 24, 2025
@github-actions
Copy link

🔍 Upstream Linux Kernel Commit Check

  • ⚠️ PR commit 134b9e739b9f (vsock: Fix transport_* TOCTOU) references upstream commit
    687aa0c5581b which has been referenced by a Fixes: tag in the upstream
    Linux kernel:
    f7c877e75352 vsock: fix lock inversion in vsock_assign_transport() (Stefano Garzarella)

This is an automated message from the kernel commit checker workflow.

jira VULN-80686
cve-bf CVE-2025-38461
commit-author Stefano Garzarella <[email protected]>
commit f7c877e

Syzbot reported a potential lock inversion deadlock between
vsock_register_mutex and sk_lock-AF_VSOCK when vsock_linger() is called.

The issue was introduced by commit 687aa0c ("vsock: Fix
transport_* TOCTOU") which added vsock_register_mutex locking in
vsock_assign_transport() around the transport->release() call, that can
call vsock_linger(). vsock_assign_transport() can be called with sk_lock
held. vsock_linger() calls sk_wait_event() that temporarily releases and
re-acquires sk_lock. During this window, if another thread hold
vsock_register_mutex while trying to acquire sk_lock, a circular
dependency is created.

Fix this by releasing vsock_register_mutex before calling
transport->release() and vsock_deassign_transport(). This is safe
because we don't need to hold vsock_register_mutex while releasing the
old transport, and we ensure the new transport won't disappear by
obtaining a module reference first via try_module_get().

	Reported-by: [email protected]
	Tested-by: [email protected]
Fixes: 687aa0c ("vsock: Fix transport_* TOCTOU")
	Cc: [email protected]
	Cc: [email protected]
	Signed-off-by: Stefano Garzarella <[email protected]>
Link: https://patch.msgid.link/[email protected]
	Signed-off-by: Paolo Abeni <[email protected]>

(cherry picked from commit f7c877e)
	Signed-off-by: Shreeya Patel <[email protected]>
Copy link
Collaborator

@bmastbergen bmastbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github's representation of the change on the 'vsock: fix lock inversion....' commit is a little different than the way the upstream change is shown which was confusing, but I think you end up with the correct code. interdiff caught this as well (see below):

FF] PR commit 8b89afe7ed553 (vsock: fix lock inversion in vsock_assign_transport()) → upstream f7c877e75352
Differences found:

  interdiff impossible; taking evasive action
  reverted:
  --- b/net/vmw_vsock/af_vsock.c
  +++ a/net/vmw_vsock/af_vsock.c
  @@ -479,9 +479,20 @@
                goto err;
        }

  +     if (vsk->transport) {
  +             if (vsk->transport == new_transport) {
  +                     ret = 0;
  +                     goto err;
  +             }
  +
  +             /* transport->release() must be called with sock lock acquired.
  +              * This path can only be taken during vsock_connect(), where we
  +              * have already held the sock lock. In the other cases, this
  +              * function is called on a new socket which is not assigned to
  +              * any transport.
  +              */
  +             vsk->transport->release(vsk);
  +             vsock_deassign_transport(vsk);
  -     if (vsk->transport && vsk->transport == new_transport) {
  -             ret = 0;
  -             goto err;
        }

        /* We increase the module refcnt to prevent the transport unloading
  @@ -498,17 +509,6 @@
         */
        mutex_unlock(&vsock_register_mutex);

  -     if (vsk->transport) {
  -             /* transport->release() must be called with sock lock acquired.
  -              * This path can only be taken during vsock_connect(), where we
  -              * have already held the sock lock. In the other cases, this
  -              * function is called on a new socket which is not assigned to
  -              * any transport.
  -              */
  -             vsk->transport->release(vsk);
  -             vsock_deassign_transport(vsk);
  -     }
  -
        if (sk->sk_type == SOCK_SEQPACKET) {
                if (!new_transport->seqpacket_allow ||
                    !new_transport->seqpacket_allow(remote_cid)) {
  unchanged:
  --- a/net/vmw_vsock/af_vsock.c
  +++ b/net/vmw_vsock/af_vsock.c
  @@ -487,12 +487,26 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
                goto err;
        }

  -     if (vsk->transport) {
  -             if (vsk->transport == new_transport) {
  -                     ret = 0;
  -                     goto err;
  -             }
  +     if (vsk->transport && vsk->transport == new_transport) {
  +             ret = 0;
  +             goto err;
  +     }

  +     /* We increase the module refcnt to prevent the transport unloading
  +      * while there are open sockets assigned to it.
  +      */
  +     if (!new_transport || !try_module_get(new_transport->module)) {
  +             ret = -ENODEV;
  +             goto err;
  +     }
  +
  +     /* It's safe to release the mutex after a successful try_module_get().
  +      * Whichever transport `new_transport` points at, it won't go away until
  +      * the last module_put() below or in vsock_deassign_transport().
  +      */
  +     mutex_unlock(&vsock_register_mutex);
  +
  +     if (vsk->transport) {
                /* transport->release() must be called with sock lock acquired.
                 * This path can only be taken during vsock_connect(), where we
                 * have already held the sock lock. In the other cases, this
  @@ -512,20 +526,6 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
                vsk->peer_shutdown = 0;
        }

  -     /* We increase the module refcnt to prevent the transport unloading
  -      * while there are open sockets assigned to it.
  -      */
  -     if (!new_transport || !try_module_get(new_transport->module)) {
  -             ret = -ENODEV;
  -             goto err;
  -     }
  -
  -     /* It's safe to release the mutex after a successful try_module_get().
  -      * Whichever transport `new_transport` points at, it won't go away until
  -      * the last module_put() below or in vsock_deassign_transport().
  -      */
  -     mutex_unlock(&vsock_register_mutex);
  -
        if (sk->sk_type == SOCK_SEQPACKET) {
                if (!new_transport->seqpacket_allow ||
                    !new_transport->seqpacket_allow(remote_cid)) {


@PlaidCat
Copy link
Collaborator

github's representation of the change on the 'vsock: fix lock inversion....' commit is a little different than the way the upstream change is shown which was confusing, but I think you end up with the correct code. interdiff caught this as well (see below):

FF] PR commit 8b89afe7ed553 (vsock: fix lock inversion in vsock_assign_transport()) → upstream f7c877e75352
Differences found:

  interdiff impossible; taking evasive action
  reverted:
  --- b/net/vmw_vsock/af_vsock.c
  +++ a/net/vmw_vsock/af_vsock.c
  @@ -479,9 +479,20 @@
                goto err;
        }

  +     if (vsk->transport) {
  +             if (vsk->transport == new_transport) {
  +                     ret = 0;
  +                     goto err;
  +             }
  +
  +             /* transport->release() must be called with sock lock acquired.
  +              * This path can only be taken during vsock_connect(), where we
  +              * have already held the sock lock. In the other cases, this
  +              * function is called on a new socket which is not assigned to
  +              * any transport.
  +              */
  +             vsk->transport->release(vsk);
  +             vsock_deassign_transport(vsk);
  -     if (vsk->transport && vsk->transport == new_transport) {
  -             ret = 0;
  -             goto err;
        }

        /* We increase the module refcnt to prevent the transport unloading
  @@ -498,17 +509,6 @@
         */
        mutex_unlock(&vsock_register_mutex);

  -     if (vsk->transport) {
  -             /* transport->release() must be called with sock lock acquired.
  -              * This path can only be taken during vsock_connect(), where we
  -              * have already held the sock lock. In the other cases, this
  -              * function is called on a new socket which is not assigned to
  -              * any transport.
  -              */
  -             vsk->transport->release(vsk);
  -             vsock_deassign_transport(vsk);
  -     }
  -
        if (sk->sk_type == SOCK_SEQPACKET) {
                if (!new_transport->seqpacket_allow ||
                    !new_transport->seqpacket_allow(remote_cid)) {
  unchanged:
  --- a/net/vmw_vsock/af_vsock.c
  +++ b/net/vmw_vsock/af_vsock.c
  @@ -487,12 +487,26 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
                goto err;
        }

  -     if (vsk->transport) {
  -             if (vsk->transport == new_transport) {
  -                     ret = 0;
  -                     goto err;
  -             }
  +     if (vsk->transport && vsk->transport == new_transport) {
  +             ret = 0;
  +             goto err;
  +     }

  +     /* We increase the module refcnt to prevent the transport unloading
  +      * while there are open sockets assigned to it.
  +      */
  +     if (!new_transport || !try_module_get(new_transport->module)) {
  +             ret = -ENODEV;
  +             goto err;
  +     }
  +
  +     /* It's safe to release the mutex after a successful try_module_get().
  +      * Whichever transport `new_transport` points at, it won't go away until
  +      * the last module_put() below or in vsock_deassign_transport().
  +      */
  +     mutex_unlock(&vsock_register_mutex);
  +
  +     if (vsk->transport) {
                /* transport->release() must be called with sock lock acquired.
                 * This path can only be taken during vsock_connect(), where we
                 * have already held the sock lock. In the other cases, this
  @@ -512,20 +526,6 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
                vsk->peer_shutdown = 0;
        }

  -     /* We increase the module refcnt to prevent the transport unloading
  -      * while there are open sockets assigned to it.
  -      */
  -     if (!new_transport || !try_module_get(new_transport->module)) {
  -             ret = -ENODEV;
  -             goto err;
  -     }
  -
  -     /* It's safe to release the mutex after a successful try_module_get().
  -      * Whichever transport `new_transport` points at, it won't go away until
  -      * the last module_put() below or in vsock_deassign_transport().
  -      */
  -     mutex_unlock(&vsock_register_mutex);
  -
        if (sk->sk_type == SOCK_SEQPACKET) {
                if (!new_transport->seqpacket_allow ||
                    !new_transport->seqpacket_allow(remote_cid)) {

Yeah this was wild.

It the big fun is we're also mistsing this which is expected and not associated with this a24009b but its not in the VULNs list so not a huge deal since this branch will get merged into the standard LTS eventually.

Copy link
Collaborator

@PlaidCat PlaidCat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@shreeya-patel98 shreeya-patel98 merged commit ab3971c into fips-9-compliant/5.14.0-284.30.1 Oct 28, 2025
3 checks passed
@shreeya-patel98 shreeya-patel98 deleted the {shreeya}_fips-9-compliant/5.14.0-284.30.1 branch October 28, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants