[PATCH V3 0/2] Fix mid_q_entry memory leaks in SMB client and further cleanup

From: Wang Zhaolong
Date: Mon Aug 11 2025 - 10:17:12 EST


This series contains the remaining patch from my previous mid processing
fix series, plus an additional cleanup patch. The first three patches of
my earlier series have already been merged into mainline.

Patch 1/2: The final patch from that series, which improves the helper
function for mid cancellation conditions. The previous helper function
had awkward semantics requiring callers to negate the return value,
and was inefficient due to the extra negation in wait loops.

Patch 2/2: A cleanup patch that removes unnecessary mid_queue_lock usage
and standardizes mid_state access with READ_ONCE/WRITE_ONCE. This builds
on the fixes to make the locking model cleaner and more consistent.

These patches are independent and can be applied separately if needed.

V3:
- Use mid_lock to protect the update of mid->callback rather than
its execution.

V2:
- Inline the mid_execute_callback() in the smb2ops.c to eliminate
the sparse warning.

Wang Zhaolong (2):
smb: client: fix mid_q_entry memleak leak with per-mid locking
smb: client: Clean up mid_queue_lock usage and standardize mid_state
access

fs/smb/client/cifsglob.h | 21 +++++++++++
fs/smb/client/cifssmb.c | 8 ++--
fs/smb/client/cifstransport.c | 69 +++++++++++++++++++++++------------
fs/smb/client/connect.c | 25 ++++++-------
fs/smb/client/smb1ops.c | 5 ++-
fs/smb/client/smb2ops.c | 26 ++++++-------
fs/smb/client/smb2pdu.c | 10 +++--
fs/smb/client/smb2transport.c | 3 +-
fs/smb/client/transport.c | 50 ++++++++++++++-----------
9 files changed, 135 insertions(+), 82 deletions(-)

--
2.39.2