Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: msetiya@microsoft.com
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] smb: client: do not defer close open handles to deleted files
Date: Tue, 27 Feb 2024 18:23:50 +0300	[thread overview]
Message-ID: <eb0bd6c4-07a9-4f23-b857-2367835cb8ef@moroto.mountain> (raw)

Hello Meetakshi Setiya,

The patch 05211603b73a: "smb: client: do not defer close open handles
to deleted files" from Feb 9, 2024 (linux-next), leads to the
following Smatch static checker warning:

	fs/smb/client/misc.c:871 cifs_mark_open_handles_for_deleted_file()
	error: 'full_path' dereferencing possible ERR_PTR()

fs/smb/client/misc.c
    860 void cifs_mark_open_handles_for_deleted_file(struct cifs_tcon *tcon,
    861                                              const char *path)
    862 {
    863         struct cifsFileInfo *cfile;
    864         void *page;
    865         const char *full_path;
    866 
    867         page = alloc_dentry_path();
    868         spin_lock(&tcon->open_file_lock);
    869         list_for_each_entry(cfile, &tcon->openFileList, tlist) {
    870                 full_path = build_path_from_dentry(cfile->dentry, page);

build_path_from_dentry() can only fail when the name is too long.  I
don't know if that's possible here...

--> 871                 if (strcmp(full_path, path) == 0)
                                   ^^^^^^^^^
This is the dereference Smatch is warning about.  Feel free to ignore
this warning if it's a false positive.  These are one time emails so
it's not a huge stress situation.

    872                         cfile->status_file_deleted = true;
    873         }
    874         spin_unlock(&tcon->open_file_lock);
    875         free_dentry_path(page);
    876 }

regards,
dan carpenter

             reply	other threads:[~2024-02-27 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 15:23 Dan Carpenter [this message]
2024-03-01  7:30 ` [EXTERNAL] [bug report] smb: client: do not defer close open handles to deleted files Meetakshi Setiya

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=eb0bd6c4-07a9-4f23-b857-2367835cb8ef@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=msetiya@microsoft.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).