cifs: Use kzfree() to zero out the password
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 27 Aug 2019 10:59:17 +0000 (13:59 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Sep 2019 05:15:38 +0000 (07:15 +0200)
[ Upstream commit 478228e57f81f6cb60798d54fc02a74ea7dd267e ]

It's safer to zero out the password so that it can never be disclosed.

Fixes: 0c219f5799c7 ("cifs: set domainName when a domain-key is used in multiuser")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/connect.c

index 699e763ea671a33e5f3d74035d8c1f87bb129090..f523a9ca9574f17aa058b17232243ac10079cfe9 100644 (file)
@@ -2662,7 +2662,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
                        rc = -ENOMEM;
                        kfree(vol->username);
                        vol->username = NULL;
-                       kfree(vol->password);
+                       kzfree(vol->password);
                        vol->password = NULL;
                        goto out_key_put;
                }