All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] configfs: fix use-after-free races in configfs_symlink()
@ 2026-11-14  5:29 Izaac Chong
  2026-11-14  5:29 ` [PATCH v2 1/2] configfs: fix use-after-free of default group " Izaac Chong
  2026-11-14  5:29 ` [PATCH v2 2/2] configfs: pin symlink target against rmdir before ->allow_link() Izaac Chong
  0 siblings, 2 replies; 5+ messages in thread
From: Izaac Chong @ 2026-11-14  5:29 UTC (permalink / raw)
  To: Breno Leitao, Andreas Hindborg, Al Viro
  Cc: linux-kernel, linux-usb, syzbot+b0996ac2197dd7420c3e, linux-nvme,
	Izaac Chong

configfs_symlink() drops the parent directory's lock while it resolves
the link target. Two races in that window are fixed here:

1/2 fixes a use-after-free when the parent is a default group whose
    containing object is freed by a concurrent rmdir (syzbot,
    nvmet_port_subsys_allow_link).
2/2 pins the target against rmdir before ->allow_link(), so drivers
    that walk the target's ->ci_parent do not see it unlinked
    (NULL deref in uvcg_streaming_header_allow_link). Found by Sashiko
    review of v1.

Changes in v2:
- Add patch 2/2. Patch 1/2 is unchanged.

Testing (QEMU + KASAN, v7.4-rc2): the syzbot
reproducer crashes without 1/2; a UVC symlink-vs-rmdir reproducer
crashes without 2/2 (with 1/2 applied). With both patches, both
reproducers plus an nvmet target-side race run clean, normal
link/unlink/rmdir still work, and rmdir of a linked target still
returns -EBUSY. syzbot #syz test is currently disabled.

Not tested: lockdep was off; LIO (target_fabric_mappedlun_link) was not
exercised.

---
Izaac Chong (2):
      configfs: fix use-after-free of default group in configfs_symlink()
      configfs: pin symlink target against rmdir before ->allow_link()

 fs/configfs/symlink.c | 66 +++++++++++++++++++++++++++++++++++----------------
 1 file changed, 46 insertions(+), 20 deletions(-)
---
base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
change-id: 20261114-configfs-symlink-uaf-c5d84bb6a976

Best regards,
--  
Izaac Chong <izaacchong934@gmail.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-14  5:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14  5:29 [PATCH v2 0/2] configfs: fix use-after-free races in configfs_symlink() Izaac Chong
2026-11-14  5:29 ` [PATCH v2 1/2] configfs: fix use-after-free of default group " Izaac Chong
2026-11-14  5:57   ` sashiko-bot
2026-11-14  5:29 ` [PATCH v2 2/2] configfs: pin symlink target against rmdir before ->allow_link() Izaac Chong
2026-11-14  5:59   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.