Skip to contentSkip to conversation

smb3: fix problem with null cifs super block with previous patch

PATCH In review Pratyush Yadav 2 participants 5 messages Apr 5, 2023 – Apr 6, 2023 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb3: fix problem with null cifs super block with previous patch

From: Steve French <[email protected]>

[ Upstream commit 87f93d82e0952da18af4d978e7d887b4c5326c0b ]

Add check for null cifs_sb to create_options helper

---

Only compile-tested. This was discovered by our static code analysis tool. I do not use CIFS and do not know how to actually reproduce the NULL dereference.

Follow up from [0]. Original patch is at [1].

Mandatory text due to licensing terms:

This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.

[0] https://lore.kernel.org/stable/[email protected]/T/#u
[1] https://lore.kernel.org/all/CAH2r5mtu69KEWU94qZK32H_8cvyhVU8GyOKrZqbdjH0ZLd95Zg@mail.gmail.com/

 fs/cifs/cifsproto.h | 2 +-
 fs/cifs/smb2ops.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifsproto.h +1 -1
index a5fab9afd699f..2dde83a969680 100644
@@ -602,7 +602,7 @@ static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
 
 static inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options)
 {
-	if (backup_cred(cifs_sb))
+	if (cifs_sb && (backup_cred(cifs_sb)))
 		return options | CREATE_OPEN_BACKUP_INTENT;
 	else
 		return options;
fs/cifs/smb2ops.c +1 -1
index 4cb0ebe7330eb..44a261b9850de 100644
@@ -2343,7 +2343,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
 				      FS_FULL_SIZE_INFORMATION,
 				      SMB2_O_INFO_FILESYSTEM,
 				      sizeof(struct smb2_fs_full_size_info),
-				      &rsp_iov, &buftype, NULL);
+				      &rsp_iov, &buftype, cifs_sb);
 	if (rc)
 		goto qfs_exit;
 

--
2.39.2

#1 lore raw
Quoted 16 lines · Pratyush Yadav

From: Steve French <[email protected]>

[ Upstream commit 87f93d82e0952da18af4d978e7d887b4c5326c0b ]

Add check for null cifs_sb to create_options helper

---

Only compile-tested. This was discovered by our static code analysis tool. I do not use CIFS and do not know how to actually reproduce the NULL dereference.

Quoted 6 lines

Follow up from [0]. Original patch is at [1].

Mandatory text due to licensing terms:

This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.

What? That's funny. And nothing I'm going to be adding to the changelog text, sorry, as that's not what is upstream. Please go poke your lawyers, that's not ok.

thanks,

greg k-h

#2 lore raw
Quoted 19 lines · Greg Kroah-Hartman
Quoted 18 lines · Pratyush Yadav

From: Steve French <[email protected]>

[ Upstream commit 87f93d82e0952da18af4d978e7d887b4c5326c0b ]

Add check for null cifs_sb to create_options helper

---

Only compile-tested. This was discovered by our static code analysis tool. I do not use CIFS and do not know how to actually reproduce the NULL dereference.

Follow up from [0]. Original patch is at [1].

Quoted 7 lines
Quoted 4 lines

Mandatory text due to licensing terms:

This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.

What? That's funny. And nothing I'm going to be adding to the changelog text, sorry, as that's not what is upstream.

That is fine by me. I placed this text below the 3 dashed lines so it does _not_ end up in the commit message, but still discloses this information.

Quoted 1 line

Please go poke your lawyers, that's not ok.

Yes, perhaps I should. But let's go forward with this patch since it keeps the original commit message?

Signature · 12 lines
Regards,
Pratyush Yadav



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
#3 lore raw
Quoted 29 lines · Pratyush Yadav
Quoted 19 lines · Greg Kroah-Hartman
Quoted 18 lines · Pratyush Yadav

From: Steve French <[email protected]>

[ Upstream commit 87f93d82e0952da18af4d978e7d887b4c5326c0b ]

Add check for null cifs_sb to create_options helper

---

Only compile-tested. This was discovered by our static code analysis tool. I do not use CIFS and do not know how to actually reproduce the NULL dereference.

Follow up from [0]. Original patch is at [1].

Quoted 7 lines
Quoted 4 lines

Mandatory text due to licensing terms:

This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.

What? That's funny. And nothing I'm going to be adding to the changelog text, sorry, as that's not what is upstream.

Quoted 8 lines

That is fine by me. I placed this text below the 3 dashed lines so it does _not_ end up in the commit message, but still discloses this information.

Quoted 1 line

Please go poke your lawyers, that's not ok.

Yes, perhaps I should. But let's go forward with this patch since it keeps the original commit message?

It's already been queued up, you should have gotten an email saying that, right?

thanks,

greg k-h

#4 lore raw
Quoted 34 lines · Greg Kroah-Hartman
Quoted 33 lines · Pratyush Yadav
Quoted 19 lines · Greg Kroah-Hartman
Quoted 18 lines · Pratyush Yadav

From: Steve French <[email protected]>

[ Upstream commit 87f93d82e0952da18af4d978e7d887b4c5326c0b ]

Add check for null cifs_sb to create_options helper

---

Only compile-tested. This was discovered by our static code analysis tool. I do not use CIFS and do not know how to actually reproduce the NULL dereference.

Follow up from [0]. Original patch is at [1].

Quoted 7 lines
Quoted 4 lines

Mandatory text due to licensing terms:

This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc.

What? That's funny. And nothing I'm going to be adding to the changelog text, sorry, as that's not what is upstream.

That is fine by me. I placed this text below the 3 dashed lines so it does _not_ end up in the commit message, but still discloses this information.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Please go poke your lawyers, that's not ok.

Yes, perhaps I should. But let's go forward with this patch since it keeps the original commit message?

It's already been queued up, you should have gotten an email saying that, right?

Yes, I did, thanks! There was a bit of a race in me sending that email and receiving the notification.

Signature · 12 lines
Regards,
Pratyush Yadav



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879