Skip to content

Commit b4885bd

Browse files
Alexandra DiupinaSteve French
authored andcommitted
cifs: avoid NULL pointer dereference in dbg call
cifs_server_dbg() implies server to be non-NULL so move call under condition to avoid NULL pointer dereference. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: e79b033 ("cifs: ignore cached share root handle closing errors") Cc: stable@vger.kernel.org Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent f089ee0 commit b4885bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/smb/client/smb2misc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,11 +816,12 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid,
816816
WARN_ONCE(tcon->tc_count < 0, "tcon refcount is negative");
817817
spin_unlock(&cifs_tcp_ses_lock);
818818

819-
if (tcon->ses)
819+
if (tcon->ses) {
820820
server = tcon->ses->server;
821-
822-
cifs_server_dbg(FYI, "tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n",
823-
tcon->tid, persistent_fid, volatile_fid);
821+
cifs_server_dbg(FYI,
822+
"tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n",
823+
tcon->tid, persistent_fid, volatile_fid);
824+
}
824825

825826
return 0;
826827
}

0 commit comments

Comments
 (0)