diff options
| author | Bernard Xiong <[email protected]> | 2026-11-16 11:29:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-11-16 11:29:11 +0800 |
| commit | 7c974b59fdc258afbdb19c378f250bcd95511537 (patch) | |
| tree | 66ab0f2b15f8ce972cda4a237cc9f0323f09bc63 /bsp/stm32/libraries/HAL_Drivers/drv_pulse_encoder.c | |
| parent | 43791bbf2e618414fa6d59c56831b6909d05f611 (diff) | |
* fix(ptyfs): release the pts file on unregister
ptyfs_unregister_pts() removed the pts file from the root list and
recycled its unit number but never freed the allocation. Repeated
open/close of /dev/pts/ptmx therefore leaked one struct ptyfs_file per
cycle and eventually exhausted the kernel heap.
Free the file after unlinking it. Also initialize pts_unit to -1 so a
failed registration does not unregister unit 0, detach the condvars
before freeing the softc on the lwp_tty_create() failure path, and skip
rt_device_unregister() for a tty that was never registered.
* fix(dfs): keep ptyfs files alive for concurrent readers
ptyfile_lookup() returned a raw pointer after releasing sb->lock, while
ptyfs_unregister_pts() removed and freed the same node. A concurrent
getdents(), setattr() or vnode lookup could then read freed memory.
Add a reference count protected by sb->lock: lookup takes a reference and
the last ptyfile_put() frees the node. The root list reference is dropped
when the file is removed, so unregistering a pts no longer frees a file
that a reader still uses. getdents() also holds the lock while walking the
subdir list, keeping the entries alive during the copy.
Diffstat (limited to 'bsp/stm32/libraries/HAL_Drivers/drv_pulse_encoder.c')
0 files changed, 0 insertions, 0 deletions
