linux/fs/smb/client
Frank Sorenson c2f2e83e3b cifs: fix cifsFileInfo leak on kmalloc failure in deferred close drain paths
In cifs_close_deferred_file(), cifs_close_all_deferred_files(), and
cifs_close_deferred_file_under_dentry(), when a pending deferred close
is cancelled via cancel_delayed_work(), the subsequent kmalloc_obj() to
add the file to the local processing list may fail under memory pressure.
The loop breaks immediately, but the cancelled work is no longer pending
(it would have called _cifsFileInfo_put()), and the cfile is never added
to file_head for processing.  The cifsFileInfo reference and the open
server handle both leak.

Fix by saving the cfile that failed allocation in a local variable,
breaking as before, and calling _cifsFileInfo_put() on it after
releasing the lock.  Any files later in the iteration are unaffected
since their deferred work is still pending and will fire normally.

Fixes: e3fc065682 ("cifs: Deferred close performance improvements")
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2026-07-21 20:19:11 -05:00
..
.gitignore smb/client: autogenerate SMB1 DOS/SRV to POSIX error mapping 2026-04-05 19:58:40 -05:00
asn1.c
cached_dir.c cifs: abort open_cached_dir if we don't request leases 2026-05-03 21:06:02 -05:00
cached_dir.h smb: client: fix (remove) drop_dir_cache module parameter 2026-04-22 09:54:21 -05:00
cifs_debug.c smb: client: fix (remove) drop_dir_cache module parameter 2026-04-22 09:54:21 -05:00
cifs_debug.h cifs: SMB1 split: cifs_debug.c 2026-02-08 17:07:45 -06:00
cifs_fs_sb.h smb: client: fix busy dentry warning on unmount after DIO 2026-07-08 18:44:42 -05:00
cifs_ioctl.h smb: client: use atomic_t for mnt_cifs_flags 2026-02-26 18:17:08 -06:00
cifs_spnego_negtokeninit.asn1
cifs_spnego.c smb: client: reject userspace cifs.spnego descriptions 2026-05-19 10:43:05 -05:00
cifs_spnego.h cifs: Scripted clean up fs/smb/client/cifs_spnego.h 2026-02-08 17:07:44 -06:00
cifs_swn.c smb: client: resolve SWN tcon from live registrations 2026-06-14 15:12:23 -05:00
cifs_swn.h cifs: Scripted clean up fs/smb/client/cifs_swn.h 2026-02-08 17:07:44 -06:00
cifs_unicode.c smb: client: Remove obsolete cmac(aes) allocation 2026-04-22 09:56:10 -05:00
cifs_unicode.h smb: client: use atomic_t for mnt_cifs_flags 2026-02-26 18:17:08 -06:00
cifsacl.c smb: client: mask server-provided mode to 07777 in modefromsid 2026-07-09 12:25:16 -05:00
cifsacl.h
cifsencrypt.c smb: client: Remove obsolete cmac(aes) allocation 2026-04-22 09:56:10 -05:00
cifsfs.c cifs: prevent readdir from changing file size due to stale directory metadata 2026-07-21 20:19:03 -05:00
cifsfs.h cifs: update internal module version number 2026-07-01 20:19:21 -05:00
cifsglob.h cifs: prevent readdir from changing file size due to stale directory metadata 2026-07-21 20:19:03 -05:00
cifspdu.h cifs: SMB1 split: Move BCC access functions 2026-02-08 17:07:45 -06:00
cifsproto.h cifs: Show reason why autodisabling serverino support 2026-07-09 08:03:19 -05:00
cifsroot.c
cifssmb.c cifs: Remove CIFSSMBSetPathInfoFB() fallback function 2026-07-09 18:24:30 -05:00
compress.c smb: move LZ77 compression into common code 2026-06-16 18:57:21 -05:00
compress.h smb: move LZ77 compression into common code 2026-06-16 18:57:21 -05:00
connect.c cifs: Show reason why autodisabling serverino support 2026-07-09 08:03:19 -05:00
dfs_cache.c cifs: Show reason why autodisabling serverino support 2026-07-09 08:03:19 -05:00
dfs_cache.h cifs: Scripted clean up fs/smb/client/dfs_cache.h 2026-02-08 17:07:44 -06:00
dfs.c
dfs.h Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dir.c openat2: new OPENAT2_REGULAR flag support 2026-05-21 15:33:47 +02:00
dns_resolve.c
dns_resolve.h cifs: Scripted clean up fs/smb/client/dns_resolve.h 2026-02-08 17:07:44 -06:00
export.c
file.c cifs: prevent readdir from changing file size due to stale directory metadata 2026-07-21 20:19:03 -05:00
fs_context.c 14 smb3 client fixes 2026-06-18 09:18:00 -07:00
fs_context.h smb: client: allow both 'lease' and 'nolease' mount options 2026-04-13 09:14:54 -05:00
fscache.c
fscache.h cifs: SMB1 split: Separate out SMB1 decls into smb1proto.h 2026-02-08 17:07:45 -06:00
gen_smb1_mapping smb/client: autogenerate SMB1 DOS/SRV to POSIX error mapping 2026-04-05 19:58:40 -05:00
gen_smb2_mapping cifs: Autogenerate SMB2 error mapping table 2026-02-08 21:23:53 -06:00
inode.c cifs: prevent readdir from changing file size due to stale directory metadata 2026-07-21 20:19:03 -05:00
ioctl.c smb/client: allow FS_IOC_SETFLAGS to clear compression 2026-06-14 15:12:23 -05:00
Kconfig 18 ksmbd server fixes 2026-04-23 17:04:18 -07:00
link.c smb/client: zero-initialize stack-allocated cifs_open_info_data 2026-07-09 07:55:55 -05:00
Makefile smb: move LZ77 compression into common code 2026-06-16 18:57:21 -05:00
misc.c cifs: fix cifsFileInfo leak on kmalloc failure in deferred close drain paths 2026-07-21 20:19:11 -05:00
namespace.c cifs: Implement fileattr_get for case sensitivity 2026-05-11 16:50:29 +02:00
netlink.c smb: client: require net admin for CIFS SWN netlink 2026-05-21 11:15:17 -05:00
netlink.h cifs: Scripted clean up fs/smb/client/netlink.h 2026-02-08 17:07:44 -06:00
netmisc.c cifs: SMB1 split: netmisc.c 2026-02-08 17:07:45 -06:00
nterr.h smb/client: replace nt_errs with ntstatus_to_dos_map 2026-04-05 19:58:40 -05:00
ntlmssp.h cifs: Scripted clean up fs/smb/client/ntlmssp.h 2026-02-08 17:07:45 -06:00
readdir.c smb: client: bound dirent name against end of SMB response in cifs_filldir 2026-07-19 22:33:38 -05:00
reparse.c smb: client: preserve leading slash for POSIX absolute symlink targets 2026-07-06 07:59:14 -05:00
reparse.h smb: client: use atomic_t for mnt_cifs_flags 2026-02-26 18:17:08 -06:00
rfc1002pdu.h
sess.c smb: client: Remove obsolete cmac(aes) allocation 2026-04-22 09:56:10 -05:00
smb1debug.c cifs: SMB1 split: cifs_debug.c 2026-02-08 17:07:45 -06:00
smb1encrypt.c smb: client: Compare MACs in constant time 2026-03-03 20:56:36 -06:00
smb1maperror_test.c smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols 2026-07-14 21:48:00 -05:00
smb1maperror.c smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols 2026-07-14 21:48:00 -05:00
smb1misc.c cifs: SMB1 split: netmisc.c 2026-02-08 17:07:45 -06:00
smb1ops.c cifs: Fix and improve cifs_is_path_accessible() function 2026-07-09 18:19:54 -05:00
smb1pdu.h smb: move compression definitions into common/fscc.h 2026-06-16 18:57:21 -05:00
smb1proto.h smb/client: allow FS_IOC_SETFLAGS to clear compression 2026-06-14 15:12:23 -05:00
smb1session.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
smb1transport.c cifs: smb1: fix comment typo 2026-03-16 21:12:40 -05:00
smb2file.c smb: client: handle STATUS_STOPPED_ON_SYMLINK responses without a symlink target 2026-07-21 15:11:07 -05:00
smb2glob.h smb/client: make SMB2 maperror KUnit tests a separate module 2026-03-01 17:59:52 -06:00
smb2inode.c smb: client: handle STATUS_STOPPED_ON_SYMLINK responses without a symlink target 2026-07-21 15:11:07 -05:00
smb2maperror_test.c smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols in SMB2 2026-07-14 21:51:19 -05:00
smb2maperror.c smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols in SMB2 2026-07-14 21:51:19 -05:00
smb2misc.c smb: client: reject overlapping data areas in SMB2 responses 2026-07-13 10:37:55 -05:00
smb2ops.c smb/client: flush dirty data before punching a hole 2026-07-14 21:51:52 -05:00
smb2pdu.c smb/client: refresh allocation after EOF-extending fallocate 2026-07-13 10:37:55 -05:00
smb2pdu.h smb: move compression definitions into common/fscc.h 2026-06-16 18:57:21 -05:00
smb2proto.h smb/client: refresh allocation after EOF-extending fallocate 2026-07-13 10:37:55 -05:00
smb2transport.c smb: client: protect tc_count increment in smb2_find_smb_sess_tcon_unlocked() 2026-05-19 10:35:12 -05:00
smbdirect.c smb: smbdirect: introduce and use include/linux/smbdirect.h 2026-05-01 16:24:25 -05:00
smbdirect.h smb: smbdirect: introduce and use include/linux/smbdirect.h 2026-05-01 16:24:25 -05:00
smbencrypt.c cifs: SMB1 split: Adjust #includes 2026-02-08 17:07:45 -06:00
smberr.h smb/client: introduce KUnit tests to check DOS/SRV err mapping search 2026-04-05 19:58:40 -05:00
trace.c
trace.h smb: client: resolve SWN tcon from live registrations 2026-06-14 15:12:23 -05:00
transport.c smb: client: avoid integer overflow in SMB2 READ length check 2026-05-14 10:55:28 -05:00
unc.c
winucase.c
xattr.c smb/client: clean up a type issue in cifs_xattr_get() 2026-06-14 15:12:24 -05:00