[bug report] cifs: cache the dirents for entries in a cached directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Ronnie Sahlberg,

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

The patch d87c48ce4d89: "cifs: cache the dirents for entries in a
cached directory" from May 10, 2022, leads to the following Smatch
complaint:

    fs/cifs/readdir.c:1108 cifs_readdir()
    warn: variable dereferenced before check 'cfid' (see line 1093)

fs/cifs/readdir.c
  1092		 */
  1093		if (cfid->dirents.is_valid) {
  1094			if (!dir_emit_dots(file, ctx)) {
  1095				mutex_unlock(&cfid->dirents.de_mutex);
  1096				goto rddir2_exit;
  1097			}
  1098			emit_cached_dirents(&cfid->dirents, ctx);
  1099			mutex_unlock(&cfid->dirents.de_mutex);
  1100			goto rddir2_exit;
  1101		}
  1102		mutex_unlock(&cfid->dirents.de_mutex);
                             ^^^^^^^^
The patch introduces these dereferences

  1103	
  1104		/* Drop the cache while calling initiate_cifs_search and
  1105		 * find_cifs_entry in case there will be reconnects during
  1106		 * query_directory.
  1107		 */
  1108		if (cfid) {
                    ^^^^
and the NULL check.

  1109			close_cached_dir(cfid);
  1110			cfid = NULL;

regards,
dan carpenter



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux