]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: support mounting with alternate password to allow password rotation
authorMeetakshi Setiya <msetiya@microsoft.com>
Wed, 30 Oct 2024 09:37:21 +0000 (05:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:17 +0000 (13:54 +0100)
commit8692643bc736419d5699891d5a87187d298ee84c
tree13ad88f81113097fb3ddc828bd301dcf92392647
parent2220bb358ef6b6047012153b3b96a4246f974a0d
cifs: support mounting with alternate password to allow password rotation

commit b9aef1b13a0a92aa7058ba235afb24b5b89153ca upstream.

Fixes the case for example where the password specified on mount is a
recently expired password, but password2 is valid.  Without this patch
this mount scenario would fail.

This patch introduces the following changes to support password rotation on
mount:

1. If an existing session is not found and the new session setup results in
EACCES, EKEYEXPIRED or EKEYREVOKED, swap password and password2 (if
available), and retry the mount.

2. To match the new mount with an existing session, add conditions to check
if a) password and password2 of the new mount and the existing session are
the same, or b) password of the new mount is the same as the password2 of
the existing session, and password2 of the new mount is the same as the
password of the existing session.

3. If an existing session is found, but needs reconnect, retry the session
setup after swapping password and password2 (if available), in case the
previous attempt results in EACCES, EKEYEXPIRED or EKEYREVOKED.

Cc: stable@vger.kernel.org
Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/client/connect.c