Blob Blame History Raw
From: Steve French <stfrench@microsoft.com>
Date: Thu, 11 Nov 2021 16:10:00 -0600
Subject: [PATCH] smb3: add additional null check in SMB2_open
Git-commit: 6b7895182ce398fa474af8cfc051754e6539c6b1
References: bsc#1190317
Patch-mainline: v5.16-rc1

Although unlikely to be possible for rsp to be null here,
the check is safer to add, and quiets a Coverity warning.

Addresses-Coverity: 1418458 ("Explicit null dereferenced")
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Paulo Alcantara <palcantara@suse.de>
---
 fs/cifs/smb2pdu.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2798,7 +2798,9 @@ SMB2_open(const unsigned int xid, struct
 			tcon->need_reconnect = true;
 		}
 		goto creat_exit;
-	} else
+	} else if (rsp == NULL) /* unlikely to happen, but safer to check */
+		goto creat_exit;
+	else
 		trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid,
 				     ses->Suid, oparms->create_options,
 				     oparms->desired_access);