* [bug report] cifs: cache the dirents for entries in a cached directory
@ 2022-05-26 10:20 Dan Carpenter
2022-05-26 19:19 ` Steve French
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-05-26 10:20 UTC (permalink / raw)
To: lsahlber; +Cc: linux-cifs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] cifs: cache the dirents for entries in a cached directory
2022-05-26 10:20 [bug report] cifs: cache the dirents for entries in a cached directory Dan Carpenter
@ 2022-05-26 19:19 ` Steve French
0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2022-05-26 19:19 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Ronnie Sahlberg, CIFS
That should be an unneeded check that causes that - had already fixed
this yesterday though
https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=9f114d7bfc6c35ca23a82efce60e0db535a186f1
On Thu, May 26, 2022 at 1:31 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-26 19:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 10:20 [bug report] cifs: cache the dirents for entries in a cached directory Dan Carpenter
2022-05-26 19:19 ` Steve French
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.