mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] w1: Fix the lifetime of slaves and their master
@ 2026-11-19 20:12 Suyuan Wang via B4 Relay
  2026-11-19 20:12 ` [PATCH 1/2] w1: Free the slave from its device release callback Suyuan Wang via B4 Relay
  2026-11-19 20:12 ` [PATCH 2/2] w1: Keep the master alive until the slave is released Suyuan Wang via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Suyuan Wang via B4 Relay @ 2026-11-19 20:12 UTC (permalink / raw)
  To: krzk; +Cc: josef, linux-kernel

w1_unref_slave() frees a slave right after unregistering its device,
while the device's release callback still uses the slave and its
master. Since commit 9fcbbac5ded4 removing a slave no longer waits for
that callback, so a delayed release (or any late reference to the
slave device) runs on freed memory.

Patch 1 frees the slave from its release callback. Patch 2 makes the
slave hold a reference to the master until then, since the master can
otherwise be freed before the delayed release of its last slave.

Found with a static analysis tool and checked by hand. Both problems
reproduce under KASAN with CONFIG_DEBUG_KOBJECT_RELEASE and a test w1
master in QEMU; details below the --- line of each patch.

---
Suyuan Wang (2):
      w1: Free the slave from its device release callback
      w1: Keep the master alive until the slave is released

 drivers/w1/w1.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)



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

end of thread, other threads:[~2026-11-19 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 20:12 [PATCH 0/2] w1: Fix the lifetime of slaves and their master Suyuan Wang via B4 Relay
2026-11-19 20:12 ` [PATCH 1/2] w1: Free the slave from its device release callback Suyuan Wang via B4 Relay
2026-11-19 20:12 ` [PATCH 2/2] w1: Keep the master alive until the slave is released Suyuan Wang via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®