Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lsahlber@redhat.com
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifs: cache dirent names for cached directories
Date: Thu, 5 May 2022 13:32:00 +0300	[thread overview]
Message-ID: <YnOnoLCxPkwERh4c@kili> (raw)

Hello Ronnie Sahlberg,

This is a semi-automatic email about new static checker warnings.

The patch 4cfa6d6563b6: "cifs: cache dirent names for cached
directories" from May 3, 2022, leads to the following Smatch
complaint:

    fs/cifs/smb2ops.c:796 open_cached_dir()
    warn: variable dereferenced before check 'tcon' (see line 780)

fs/cifs/smb2ops.c
   779	{
   780		struct cifs_ses *ses = tcon->ses;
                                       ^^^^^^^^^
Dereference

   781		struct TCP_Server_Info *server = ses->server;
   782		struct cifs_open_parms oparms;
   783		struct smb2_create_rsp *o_rsp = NULL;
   784		struct smb2_query_info_rsp *qi_rsp = NULL;
   785		int resp_buftype[2];
   786		struct smb_rqst rqst[2];
   787		struct kvec rsp_iov[2];
   788		struct kvec open_iov[SMB2_CREATE_IOV_SIZE];
   789		struct kvec qi_iov[1];
   790		int rc, flags = 0;
   791		__le16 utf16_path = 0; /* Null - since an open of top of share */
   792		u8 oplock = SMB2_OPLOCK_LEVEL_II;
   793		struct cifs_fid *pfid;
   794		struct dentry *dentry;
   795	
   796		if (tcon == NULL || tcon->nohandlecache ||
                    ^^^^^^^^^^^^
The patch adds a new NULL check, but too late.

   797		    is_smb1_server(tcon->ses->server))
   798			return -ENOTSUPP;

regards,
dan carpenter

                 reply	other threads:[~2022-05-05 10:32 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=YnOnoLCxPkwERh4c@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.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