Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Kinglong Mee <kinglongmee@gmail.com>
To: Steve French <sfrench@samba.org>
Cc: kinglongmee@gmail.com, linux-cifs@vger.kernel.org
Subject: cifsFileInfo leak when doing cifs_atomic_open on a symlink file
Date: Sun, 24 Apr 2022 17:53:55 +0800	[thread overview]
Message-ID: <0663e8e2-8c09-eee4-159a-f82c67eba80e@gmail.com> (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

                 reply	other threads:[~2022-04-24  9:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0663e8e2-8c09-eee4-159a-f82c67eba80e@gmail.com \
    --to=kinglongmee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox