cifs: Fix leak when handling lease break for cached root fid
Subsystems (2)
PATCH 1/1 cifs: Fix leak when handling lease break for cached root fid
As observed with kmemleak:
unreferenced object 0xffff98383a5af480 (size 128):
comm "cifsd", pid 684, jiffies 4294936606 (age 534.868s)
hex dump (first 32 bytes):
c0 ff ff ff 1f 00 00 00 88 f4 5a 3a 38 98 ff ff ..........Z:8...
88 f4 5a 3a 38 98 ff ff 80 88 d6 8a ff ff ff ff ..Z:8...........
backtrace:
[<0000000068957336>] smb2_is_valid_oplock_break+0x1fa/0x8c0
[<0000000073b70b9e>] cifs_demultiplex_thread+0x73d/0xcc0
[<00000000905fa372>] kthread+0x11c/0x150
[<0000000079378e4e>] ret_from_fork+0x22/0x30Fixes a93864d93977 ("cifs: add lease tracking to the cached root fid")
Signed-off-by Paul Aurich <[email protected]>
CC Stable <[email protected]> # v4.18+
--- fs/cifs/smb2misc.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smb2misc.c +1 -0
@@ -619,6 +619,7 @@ smb2_is_valid_lease_break(char *buffer)queue_work (cifsiod_wq, &tcon->crfid.lease_break);spin_unlock (&cifs_tcp_ses_lock); +kfree (lw);return true; } }
Signature · 1 line
2.27.0
Hi,
Good catch! Change looks good to me but I think we should move lw allocation inside smb2_tcon_has_lease() so that we don't have to track it across multiple functions as it is only used there. Could you send a v2 doing that?
Cheers,
Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)