Skip to content

mISDN: fix socket/device lifetime and naming races

Shuvam Pandey lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 2 repliesIn review

Changes in v2 from the cover letter

- split the fix into three focused patches
- close sockets before delete_stack() and wait for the final device release
- serialize bind and ioctl lookup/rename paths against unregister
- cache stable device names for mISDN paths outside the kobject
- keep existing debug behavior while switching layer1 name reads to the cached name
- document the device_lock(dev) -> lock_sock(sk) ordering
- build-test the series on arm64 with W=1 for drivers/isdn/mISDN and drivers/isdn/hardware/mISDN

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mISDN: serialize socket teardown against device unregisterdrivers/isdn/mISDN/core.c drivers/isdn/mISDN/core.h drivers/isdn/mISDN/socket.c +1 more+216 -290 replies
2/3mISDN: socket: drop temporary references from get_mdevice()drivers/isdn/mISDN/socket.c+28 -30 replies
3/3mISDN: cache stable device names outside the kobjectdrivers/isdn/mISDN/core.c drivers/isdn/mISDN/layer1.c drivers/isdn/mISDN/socket.c +3 more+42 -290 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] mISDN: fix socket/device lifetime and naming races

This is a respin of the original get_mdevice() reference leak fix.

Patch 1 makes unregister wait for the last device reference and closes sockets that still point at the device before delete_stack() runs. It also serializes bind against unregister so a new socket cannot attach once teardown has started.

Patch 2 drops the temporary get_mdevice() references from IMGETDEVINFO and IMSETDEVNAME, and serializes those ioctl paths against unregister.

Patch 3 keeps an mISDN-owned copy of the device name so ioctl, sysfs, and debug paths no longer depend on the kobject name storage remaining stable across device_rename().

Previous discussion:
https://lore.kernel.org/r/[email protected]

This series was developed with AI assistance. I reviewed, revised, and tested it, and I take responsibility for the submission.

---
Changes in v2:
- split the fix into three focused patches
- close sockets before delete_stack() and wait for the final device release
- serialize bind and ioctl lookup/rename paths against unregister
- cache stable device names for mISDN paths outside the kobject
- keep existing debug behavior while switching layer1 name reads to the cached name
- document the device_lock(dev) -> lock_sock(sk) ordering
- build-test the series on arm64 with W=1 for drivers/isdn/mISDN and drivers/isdn/hardware/mISDN

Shuvam Pandey (3):
mISDN: serialize socket teardown against device unregister
mISDN: socket: drop temporary references from get_mdevice()
mISDN: cache stable device names outside the kobject

 drivers/isdn/mISDN/core.c   |  37 ++++-
 drivers/isdn/mISDN/core.h   |   1 +
 drivers/isdn/mISDN/layer1.c |   2 +-
 drivers/isdn/mISDN/socket.c | 263 +++++++++++++++++++++++++++++++-----
 drivers/isdn/mISDN/stack.c  |  36 ++---
 drivers/isdn/mISDN/tei.c    |   2 +-
 include/linux/mISDNif.h     |   2 +
 7 files changed, 284 insertions(+), 59 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)