Skip to contentSkip to conversation

cifsFileInfo leak when doing cifs_atomic_open on a symlink file

DISCUSSION Kinglong Mee 1 participant 1 message Apr 24, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi steve,

Recently I've started running LTP tests with mfsymlinks mount option.

The LTP test "fs_racer" triggers the cifsFileInfo leak when doing cifs_atomic_open on a symlink file.

After testing and umounting cifs mount, there are some files exist in /proc/fs/cifs/open_files as,

#cat /proc/fs/cifs/open_files
# Version:1
# Format:
# <tree id> <persistent fid> <flags> <count> <pid> <uid> <filename> 0x2 0x94c08 0x8401 1 1554873 0 11
0x2 0x94b5f 0x8401 1 1554808 0 7
0x2 0x947cf 0x8401 1 1554365 0 0
0x2 0x9470a 0x8401 1 1554339 0 0

and the tcp socket also left,

# netstat -an |grep 445
tcp        0      0 192.168.123.123:38050    192.168.123.124:445 ESTABLISHED

and the cifsd left too.

# ps -ajx |grep cifsd
      2   34030       0       0 ?             -1 S        0   2:20 [cifsd]

I found the fs_racer cause cifs doing cifs_atomic_open on symlink file, but the symlink file does not contain a valid i_fop setting, it means, the cifsFileInfo allocated for the symlink file never be un-referenced.

I'd wanna know, is cifs_atomic_open on symlink file allowed? If allowed, a cifs_close for symlink file is needed. Otherwise, cifs_atomic_open needs return error for symlink file.

Any comments are welcome.

Thanks,
Kinglong Mee