Skip to contentSkip to conversation

cifs: Fix an error pointer dereference in cifs_mount()

PATCH New Dan Carpenter 1 participant 1 message Aug 5, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Fix an error pointer dereference in cifs_mount()

The error handling calls kfree(full_path) so we can't let it be a NULL pointer. There used to be a NULL assignment here but we accidentally deleted it. Add it back.

Fixes 7efd08158261 ("cifs: document and cleanup dfs mount")
---
 fs/cifs/connect.c | 1 +
 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
index 0ad1309e88d3..a275ee399dce 100644
@@ -4886,6 +4886,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol)
 		full_path = build_unc_path_to_root(vol, cifs_sb, !!count);
 		if (IS_ERR(full_path)) {
 			rc = PTR_ERR(full_path);
+			full_path = NULL;
 			break;
 		}
 		/* Chase referral */
Signature · 1 line
2.27.0