Skip to contentSkip to conversation

cifs: Use kzfree() to free password

PATCH Applied Dan Carpenter 3 participants 4 messages Dec 20, 2018 – Dec 21, 2018 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Use kzfree() to free password

We should zero out the password before we free it.

Fixes 3d6cacbb5310 ("cifs: Add DFS cache routines")
---
 fs/cifs/dfs_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dfs_cache.c +1 -1
index f74567788396..006333146a6d 100644
@@ -1130,7 +1130,7 @@ static int dup_vol(struct smb_vol *vol, struct smb_vol *new)
 err_free_unc:
 	kfree(new->UNC);
 err_free_password:
-	kfree(new->password);
+	kzfree(new->password);
 err_free_username:
 	kfree(new->username);
 	kfree(new);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Dan Carpenter

We should zero out the password before we free it.

Fixes 3d6cacbb5310 ("cifs: Add DFS cache routines")
---
 fs/cifs/dfs_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dfs_cache.c +1 -1
index f74567788396..006333146a6d 100644
@@ -1130,7 +1130,7 @@ static int dup_vol(struct smb_vol *vol, struct smb_vol *new)
 err_free_unc:
 	kfree(new->UNC);
 err_free_password:
-	kfree(new->password);
+	kzfree(new->password);
 err_free_username:
 	kfree(new->username);
 	kfree(new);
Signature · 1 line
2.17.1

Thanks!
Paulo

#2 lore raw
In reply to Dan Carpenter

Good catch

Quoted 26 lines · Dan Carpenter via samba-technical

We should zero out the password before we free it.

Fixes 3d6cacbb5310 ("cifs: Add DFS cache routines")
---
 fs/cifs/dfs_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dfs_cache.c +1 -2
index f74567788396..006333146a6d 100644
@@ -1130,7 +1130,7 @@ static int dup_vol(struct smb_vol *vol, struct smb_vol *new)
 err_free_unc:
        kfree(new->UNC);
 err_free_password:
-       kfree(new->password);
+       kzfree(new->password);
 err_free_username:
        kfree(new->username);
        kfree(new);
--

2.17.1

Signature · 3 lines
Thanks,

Steve
Applied
#3 lore raw
In reply to Dan Carpenter

merged into cifs-2.6.git for-next

Quoted 31 lines · Paulo Alcantara
Quoted 22 lines · Dan Carpenter

We should zero out the password before we free it.

Fixes 3d6cacbb5310 ("cifs: Add DFS cache routines")
---
 fs/cifs/dfs_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dfs_cache.c +1 -2
index f74567788396..006333146a6d 100644
@@ -1130,7 +1130,7 @@ static int dup_vol(struct smb_vol *vol, struct smb_vol *new)
 err_free_unc:
      kfree(new->UNC);
 err_free_password:
-     kfree(new->password);
+     kzfree(new->password);
 err_free_username:
      kfree(new->username);
      kfree(new);
--
Quoted 1 line

2.17.1

Thanks!
Paulo

Signature · 3 lines
Thanks,

Steve