]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jan 2025 13:40:43 +0000 (14:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jan 2025 13:40:43 +0000 (14:40 +0100)
added patches:
blk-cgroup-fix-uaf-in-blkcg_unpin_online.patch
ipv6-avoid-possible-null-deref-in-rt6_uncached_list_flush_dev.patch
nfsd-add-list_head-nf_gc-to-struct-nfsd_file.patch
vsock-virtio-discard-packets-if-the-transport-changes.patch

queue-5.15/blk-cgroup-fix-uaf-in-blkcg_unpin_online.patch [new file with mode: 0644]
queue-5.15/ipv6-avoid-possible-null-deref-in-rt6_uncached_list_flush_dev.patch [new file with mode: 0644]
queue-5.15/nfsd-add-list_head-nf_gc-to-struct-nfsd_file.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/vsock-virtio-discard-packets-if-the-transport-changes.patch [new file with mode: 0644]

diff --git a/queue-5.15/blk-cgroup-fix-uaf-in-blkcg_unpin_online.patch b/queue-5.15/blk-cgroup-fix-uaf-in-blkcg_unpin_online.patch
new file mode 100644 (file)
index 0000000..a36a892
--- /dev/null
@@ -0,0 +1,82 @@
+From 86e6ca55b83c575ab0f2e105cf08f98e58d3d7af Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Fri, 6 Dec 2024 07:59:51 -1000
+Subject: blk-cgroup: Fix UAF in blkcg_unpin_online()
+
+From: Tejun Heo <tj@kernel.org>
+
+commit 86e6ca55b83c575ab0f2e105cf08f98e58d3d7af upstream.
+
+blkcg_unpin_online() walks up the blkcg hierarchy putting the online pin. To
+walk up, it uses blkcg_parent(blkcg) but it was calling that after
+blkcg_destroy_blkgs(blkcg) which could free the blkcg, leading to the
+following UAF:
+
+  ==================================================================
+  BUG: KASAN: slab-use-after-free in blkcg_unpin_online+0x15a/0x270
+  Read of size 8 at addr ffff8881057678c0 by task kworker/9:1/117
+
+  CPU: 9 UID: 0 PID: 117 Comm: kworker/9:1 Not tainted 6.13.0-rc1-work-00182-gb8f52214c61a-dirty #48
+  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS unknown 02/02/2022
+  Workqueue: cgwb_release cgwb_release_workfn
+  Call Trace:
+   <TASK>
+   dump_stack_lvl+0x27/0x80
+   print_report+0x151/0x710
+   kasan_report+0xc0/0x100
+   blkcg_unpin_online+0x15a/0x270
+   cgwb_release_workfn+0x194/0x480
+   process_scheduled_works+0x71b/0xe20
+   worker_thread+0x82a/0xbd0
+   kthread+0x242/0x2c0
+   ret_from_fork+0x33/0x70
+   ret_from_fork_asm+0x1a/0x30
+   </TASK>
+  ...
+  Freed by task 1944:
+   kasan_save_track+0x2b/0x70
+   kasan_save_free_info+0x3c/0x50
+   __kasan_slab_free+0x33/0x50
+   kfree+0x10c/0x330
+   css_free_rwork_fn+0xe6/0xb30
+   process_scheduled_works+0x71b/0xe20
+   worker_thread+0x82a/0xbd0
+   kthread+0x242/0x2c0
+   ret_from_fork+0x33/0x70
+   ret_from_fork_asm+0x1a/0x30
+
+Note that the UAF is not easy to trigger as the free path is indirected
+behind a couple RCU grace periods and a work item execution. I could only
+trigger it with artifical msleep() injected in blkcg_unpin_online().
+
+Fix it by reading the parent pointer before destroying the blkcg's blkg's.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Reported-by: Abagail ren <renzezhongucas@gmail.com>
+Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
+Fixes: 4308a434e5e0 ("blkcg: don't offline parent blkcg first")
+Cc: stable@vger.kernel.org # v5.7+
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/blk-cgroup.h |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/include/linux/blk-cgroup.h
++++ b/include/linux/blk-cgroup.h
+@@ -433,10 +433,14 @@ static inline void blkcg_pin_online(stru
+ static inline void blkcg_unpin_online(struct blkcg *blkcg)
+ {
+       do {
++              struct blkcg *parent;
++
+               if (!refcount_dec_and_test(&blkcg->online_pin))
+                       break;
++
++              parent = blkcg_parent(blkcg);
+               blkcg_destroy_blkgs(blkcg);
+-              blkcg = blkcg_parent(blkcg);
++              blkcg = parent;
+       } while (blkcg);
+ }
diff --git a/queue-5.15/ipv6-avoid-possible-null-deref-in-rt6_uncached_list_flush_dev.patch b/queue-5.15/ipv6-avoid-possible-null-deref-in-rt6_uncached_list_flush_dev.patch
new file mode 100644 (file)
index 0000000..89093ec
--- /dev/null
@@ -0,0 +1,107 @@
+From 04ccecfa959d3b9ae7348780d8e379c6486176ac Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet@google.com>
+Date: Fri, 13 Sep 2024 08:31:47 +0000
+Subject: ipv6: avoid possible NULL deref in rt6_uncached_list_flush_dev()
+
+From: Eric Dumazet <edumazet@google.com>
+
+commit 04ccecfa959d3b9ae7348780d8e379c6486176ac upstream.
+
+Blamed commit accidentally removed a check for rt->rt6i_idev being NULL,
+as spotted by syzbot:
+
+Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI
+KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
+CPU: 1 UID: 0 PID: 10998 Comm: syz-executor Not tainted 6.11.0-rc6-syzkaller-00208-g625403177711 #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
+ RIP: 0010:rt6_uncached_list_flush_dev net/ipv6/route.c:177 [inline]
+ RIP: 0010:rt6_disable_ip+0x33e/0x7e0 net/ipv6/route.c:4914
+Code: 41 80 3c 04 00 74 0a e8 90 d0 9b f7 48 8b 7c 24 08 48 8b 07 48 89 44 24 10 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 f7 e8 64 d0 9b f7 48 8b 44 24 18 49 39 06
+RSP: 0018:ffffc900047374e0 EFLAGS: 00010246
+RAX: 0000000000000000 RBX: 1ffff1100fdf8f33 RCX: dffffc0000000000
+RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff88807efc78c0
+RBP: ffffc900047375d0 R08: 0000000000000003 R09: fffff520008e6e8c
+R10: dffffc0000000000 R11: fffff520008e6e8c R12: 1ffff1100fdf8f18
+R13: ffff88807efc7998 R14: 0000000000000000 R15: ffff88807efc7930
+FS:  0000000000000000(0000) GS:ffff8880b8900000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 0000000020002a80 CR3: 0000000022f62000 CR4: 00000000003506f0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+Call Trace:
+ <TASK>
+  addrconf_ifdown+0x15d/0x1bd0 net/ipv6/addrconf.c:3856
+ addrconf_notify+0x3cb/0x1020
+  notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93
+  call_netdevice_notifiers_extack net/core/dev.c:2032 [inline]
+  call_netdevice_notifiers net/core/dev.c:2046 [inline]
+  unregister_netdevice_many_notify+0xd81/0x1c40 net/core/dev.c:11352
+  unregister_netdevice_many net/core/dev.c:11414 [inline]
+  unregister_netdevice_queue+0x303/0x370 net/core/dev.c:11289
+  unregister_netdevice include/linux/netdevice.h:3129 [inline]
+  __tun_detach+0x6b9/0x1600 drivers/net/tun.c:685
+  tun_detach drivers/net/tun.c:701 [inline]
+  tun_chr_close+0x108/0x1b0 drivers/net/tun.c:3510
+  __fput+0x24a/0x8a0 fs/file_table.c:422
+  task_work_run+0x24f/0x310 kernel/task_work.c:228
+  exit_task_work include/linux/task_work.h:40 [inline]
+  do_exit+0xa2f/0x27f0 kernel/exit.c:882
+  do_group_exit+0x207/0x2c0 kernel/exit.c:1031
+  __do_sys_exit_group kernel/exit.c:1042 [inline]
+  __se_sys_exit_group kernel/exit.c:1040 [inline]
+  __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1040
+  x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232
+  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+  do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+RIP: 0033:0x7f1acc77def9
+Code: Unable to access opcode bytes at 0x7f1acc77decf.
+RSP: 002b:00007ffeb26fa738 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
+RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1acc77def9
+RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000043
+RBP: 00007f1acc7dd508 R08: 00007ffeb26f84d7 R09: 0000000000000003
+R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
+R13: 0000000000000003 R14: 00000000ffffffff R15: 00007ffeb26fa8e0
+ </TASK>
+Modules linked in:
+---[ end trace 0000000000000000 ]---
+ RIP: 0010:rt6_uncached_list_flush_dev net/ipv6/route.c:177 [inline]
+ RIP: 0010:rt6_disable_ip+0x33e/0x7e0 net/ipv6/route.c:4914
+Code: 41 80 3c 04 00 74 0a e8 90 d0 9b f7 48 8b 7c 24 08 48 8b 07 48 89 44 24 10 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 f7 e8 64 d0 9b f7 48 8b 44 24 18 49 39 06
+RSP: 0018:ffffc900047374e0 EFLAGS: 00010246
+RAX: 0000000000000000 RBX: 1ffff1100fdf8f33 RCX: dffffc0000000000
+RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff88807efc78c0
+RBP: ffffc900047375d0 R08: 0000000000000003 R09: fffff520008e6e8c
+R10: dffffc0000000000 R11: fffff520008e6e8c R12: 1ffff1100fdf8f18
+R13: ffff88807efc7998 R14: 0000000000000000 R15: ffff88807efc7930
+FS:  0000000000000000(0000) GS:ffff8880b8900000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 0000000020002a80 CR3: 0000000022f62000 CR4: 00000000003506f0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+
+Fixes: e332bc67cf5e ("ipv6: Don't call with rt6_uncached_list_flush_dev")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
+Link: https://patch.msgid.link/20240913083147.3095442-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: BRUNO VERNAY <bruno.vernay@se.com>
+Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/route.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/ipv6/route.c
++++ b/net/ipv6/route.c
+@@ -176,7 +176,7 @@ static void rt6_uncached_list_flush_dev(
+                       struct inet6_dev *rt_idev = rt->rt6i_idev;
+                       struct net_device *rt_dev = rt->dst.dev;
+-                      if (rt_idev->dev == dev) {
++                      if (rt_idev && rt_idev->dev == dev) {
+                               rt->rt6i_idev = in6_dev_get(loopback_dev);
+                               in6_dev_put(rt_idev);
+                       }
diff --git a/queue-5.15/nfsd-add-list_head-nf_gc-to-struct-nfsd_file.patch b/queue-5.15/nfsd-add-list_head-nf_gc-to-struct-nfsd_file.patch
new file mode 100644 (file)
index 0000000..9b0e05e
--- /dev/null
@@ -0,0 +1,139 @@
+From 8e6e2ffa6569a205f1805cbaeca143b556581da6 Mon Sep 17 00:00:00 2001
+From: Youzhong Yang <youzhong@gmail.com>
+Date: Wed, 10 Jul 2024 10:40:35 -0400
+Subject: nfsd: add list_head nf_gc to struct nfsd_file
+
+From: Youzhong Yang <youzhong@gmail.com>
+
+commit 8e6e2ffa6569a205f1805cbaeca143b556581da6 upstream.
+
+nfsd_file_put() in one thread can race with another thread doing
+garbage collection (running nfsd_file_gc() -> list_lru_walk() ->
+nfsd_file_lru_cb()):
+
+  * In nfsd_file_put(), nf->nf_ref is 1, so it tries to do nfsd_file_lru_add().
+  * nfsd_file_lru_add() returns true (with NFSD_FILE_REFERENCED bit set)
+  * garbage collector kicks in, nfsd_file_lru_cb() clears REFERENCED bit and
+    returns LRU_ROTATE.
+  * garbage collector kicks in again, nfsd_file_lru_cb() now decrements nf->nf_ref
+    to 0, runs nfsd_file_unhash(), removes it from the LRU and adds to the dispose
+    list [list_lru_isolate_move(lru, &nf->nf_lru, head)]
+  * nfsd_file_put() detects NFSD_FILE_HASHED bit is cleared, so it tries to remove
+    the 'nf' from the LRU [if (!nfsd_file_lru_remove(nf))]. The 'nf' has been added
+    to the 'dispose' list by nfsd_file_lru_cb(), so nfsd_file_lru_remove(nf) simply
+    treats it as part of the LRU and removes it, which leads to its removal from
+    the 'dispose' list.
+  * At this moment, 'nf' is unhashed with its nf_ref being 0, and not on the LRU.
+    nfsd_file_put() continues its execution [if (refcount_dec_and_test(&nf->nf_ref))],
+    as nf->nf_ref is already 0, nf->nf_ref is set to REFCOUNT_SATURATED, and the 'nf'
+    gets no chance of being freed.
+
+nfsd_file_put() can also race with nfsd_file_cond_queue():
+  * In nfsd_file_put(), nf->nf_ref is 1, so it tries to do nfsd_file_lru_add().
+  * nfsd_file_lru_add() sets REFERENCED bit and returns true.
+  * Some userland application runs 'exportfs -f' or something like that, which triggers
+    __nfsd_file_cache_purge() -> nfsd_file_cond_queue().
+  * In nfsd_file_cond_queue(), it runs [if (!nfsd_file_unhash(nf))], unhash is done
+    successfully.
+  * nfsd_file_cond_queue() runs [if (!nfsd_file_get(nf))], now nf->nf_ref goes to 2.
+  * nfsd_file_cond_queue() runs [if (nfsd_file_lru_remove(nf))], it succeeds.
+  * nfsd_file_cond_queue() runs [if (refcount_sub_and_test(decrement, &nf->nf_ref))]
+    (with "decrement" being 2), so the nf->nf_ref goes to 0, the 'nf' is added to the
+    dispose list [list_add(&nf->nf_lru, dispose)]
+  * nfsd_file_put() detects NFSD_FILE_HASHED bit is cleared, so it tries to remove
+    the 'nf' from the LRU [if (!nfsd_file_lru_remove(nf))], although the 'nf' is not
+    in the LRU, but it is linked in the 'dispose' list, nfsd_file_lru_remove() simply
+    treats it as part of the LRU and removes it. This leads to its removal from
+    the 'dispose' list!
+  * Now nf->ref is 0, unhashed. nfsd_file_put() continues its execution and set
+    nf->nf_ref to REFCOUNT_SATURATED.
+
+As shown in the above analysis, using nf_lru for both the LRU list and dispose list
+can cause the leaks. This patch adds a new list_head nf_gc in struct nfsd_file, and uses
+it for the dispose list. This does not fix the nfsd_file leaking issue completely.
+
+Signed-off-by: Youzhong Yang <youzhong@gmail.com>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfsd/filecache.c |   18 ++++++++++--------
+ fs/nfsd/filecache.h |    1 +
+ 2 files changed, 11 insertions(+), 8 deletions(-)
+
+--- a/fs/nfsd/filecache.c
++++ b/fs/nfsd/filecache.c
+@@ -218,6 +218,7 @@ nfsd_file_alloc(struct net *net, struct
+               return NULL;
+       INIT_LIST_HEAD(&nf->nf_lru);
++      INIT_LIST_HEAD(&nf->nf_gc);
+       nf->nf_birthtime = ktime_get();
+       nf->nf_file = NULL;
+       nf->nf_cred = get_current_cred();
+@@ -395,8 +396,8 @@ nfsd_file_dispose_list(struct list_head
+       struct nfsd_file *nf;
+       while (!list_empty(dispose)) {
+-              nf = list_first_entry(dispose, struct nfsd_file, nf_lru);
+-              list_del_init(&nf->nf_lru);
++              nf = list_first_entry(dispose, struct nfsd_file, nf_gc);
++              list_del_init(&nf->nf_gc);
+               nfsd_file_free(nf);
+       }
+ }
+@@ -413,12 +414,12 @@ nfsd_file_dispose_list_delayed(struct li
+ {
+       while(!list_empty(dispose)) {
+               struct nfsd_file *nf = list_first_entry(dispose,
+-                                              struct nfsd_file, nf_lru);
++                                              struct nfsd_file, nf_gc);
+               struct nfsd_net *nn = net_generic(nf->nf_net, nfsd_net_id);
+               struct nfsd_fcache_disposal *l = nn->fcache_disposal;
+               spin_lock(&l->lock);
+-              list_move_tail(&nf->nf_lru, &l->freeme);
++              list_move_tail(&nf->nf_gc, &l->freeme);
+               spin_unlock(&l->lock);
+               queue_work(nfsd_filecache_wq, &l->work);
+       }
+@@ -475,7 +476,8 @@ nfsd_file_lru_cb(struct list_head *item,
+       /* Refcount went to zero. Unhash it and queue it to the dispose list */
+       nfsd_file_unhash(nf);
+-      list_lru_isolate_move(lru, &nf->nf_lru, head);
++      list_lru_isolate(lru, &nf->nf_lru);
++      list_add(&nf->nf_gc, head);
+       this_cpu_inc(nfsd_file_evictions);
+       trace_nfsd_file_gc_disposed(nf);
+       return LRU_REMOVED;
+@@ -554,7 +556,7 @@ nfsd_file_cond_queue(struct nfsd_file *n
+       /* If refcount goes to 0, then put on the dispose list */
+       if (refcount_sub_and_test(decrement, &nf->nf_ref)) {
+-              list_add(&nf->nf_lru, dispose);
++              list_add(&nf->nf_gc, dispose);
+               trace_nfsd_file_closing(nf);
+       }
+ }
+@@ -630,8 +632,8 @@ nfsd_file_close_inode_sync(struct inode
+       nfsd_file_queue_for_close(inode, &dispose);
+       while (!list_empty(&dispose)) {
+-              nf = list_first_entry(&dispose, struct nfsd_file, nf_lru);
+-              list_del_init(&nf->nf_lru);
++              nf = list_first_entry(&dispose, struct nfsd_file, nf_gc);
++              list_del_init(&nf->nf_gc);
+               nfsd_file_free(nf);
+       }
+       flush_delayed_fput();
+--- a/fs/nfsd/filecache.h
++++ b/fs/nfsd/filecache.h
+@@ -44,6 +44,7 @@ struct nfsd_file {
+       struct nfsd_file_mark   *nf_mark;
+       struct list_head        nf_lru;
++      struct list_head        nf_gc;
+       struct rcu_head         nf_rcu;
+       ktime_t                 nf_birthtime;
+ };
index 738e909087e50fd46f3881b619163f74a2a729ce..c3a892bcc4bcdf74f1915a72d22962f2cc506d61 100644 (file)
@@ -118,3 +118,7 @@ iio-imu-inv_icm42600-fix-timestamps-after-suspend-if-sensor-is-on.patch
 iio-adc-rockchip_saradc-fix-information-leak-in-triggered-buffer.patch
 revert-drm-amdgpu-rework-resume-handling-for-display-v2.patch
 revert-regmap-detach-regmap-from-dev-on-regmap_exit.patch
+blk-cgroup-fix-uaf-in-blkcg_unpin_online.patch
+vsock-virtio-discard-packets-if-the-transport-changes.patch
+ipv6-avoid-possible-null-deref-in-rt6_uncached_list_flush_dev.patch
+nfsd-add-list_head-nf_gc-to-struct-nfsd_file.patch
diff --git a/queue-5.15/vsock-virtio-discard-packets-if-the-transport-changes.patch b/queue-5.15/vsock-virtio-discard-packets-if-the-transport-changes.patch
new file mode 100644 (file)
index 0000000..c9189e0
--- /dev/null
@@ -0,0 +1,50 @@
+From 2cb7c756f605ec02ffe562fb26828e4bcc5fdfc1 Mon Sep 17 00:00:00 2001
+From: Stefano Garzarella <sgarzare@redhat.com>
+Date: Fri, 10 Jan 2025 09:35:07 +0100
+Subject: vsock/virtio: discard packets if the transport changes
+
+From: Stefano Garzarella <sgarzare@redhat.com>
+
+commit 2cb7c756f605ec02ffe562fb26828e4bcc5fdfc1 upstream.
+
+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: c0cfa2d8a788 ("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>
+[SG: fixed context conflict since this tree is missing commit 71dc9ec9ac7d
+ ("virtio/vsock: replace virtio_vsock_pkt with sk_buff")]
+Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/vmw_vsock/virtio_transport_common.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/net/vmw_vsock/virtio_transport_common.c
++++ b/net/vmw_vsock/virtio_transport_common.c
+@@ -1317,8 +1317,11 @@ void virtio_transport_recv_pkt(struct vi
+       lock_sock(sk);
+-      /* Check if sk has been closed before lock_sock */
+-      if (sock_flag(sk, SOCK_DONE)) {
++      /* Check if sk has been closed or assigned to another transport before
++       * lock_sock (note: listener sockets are not assigned to any transport)
++       */
++      if (sock_flag(sk, SOCK_DONE) ||
++          (sk->sk_state != TCP_LISTEN && vsk->transport != &t->transport)) {
+               (void)virtio_transport_reset_no_sock(t, pkt);
+               release_sock(sk);
+               sock_put(sk);