From: Alexandra Diupina Date: Wed, 19 Mar 2025 14:28:58 +0000 (+0300) Subject: cifs: avoid NULL pointer dereference in dbg call X-Git-Tag: v5.10.237~65 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba3ce6c60cd5db258687dfeba9fc608f5e7cadf3;p=thirdparty%2Fkernel%2Fstable.git cifs: avoid NULL pointer dereference in dbg call [ Upstream commit b4885bd5935bb26f0a414ad55679a372e53f9b9b ] 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: e79b0332ae06 ("cifs: ignore cached share root handle closing errors") Cc: stable@vger.kernel.org Signed-off-by: Alexandra Diupina Signed-off-by: Steve French Signed-off-by: Sasha Levin --- diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index d21b27e68f2a8..c0b80ba8875af 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c @@ -809,11 +809,12 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, WARN_ONCE(tcon->tc_count < 0, "tcon refcount is negative"); spin_unlock(&cifs_tcp_ses_lock); - if (tcon->ses) + if (tcon->ses) { server = tcon->ses->server; - - cifs_server_dbg(FYI, "tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n", - tcon->tid, persistent_fid, volatile_fid); + cifs_server_dbg(FYI, + "tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n", + tcon->tid, persistent_fid, volatile_fid); + } return 0; }