Re: [PATCH] ksmbd: defer destroy_previous_session() until after NTLM authentication

Namjae Jeon <[email protected]>
Newsgroups org.kernel.vger.linux-cifs,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CAKYAXd-t2Oz4ZM8BWkJ7uKciaGo=akTMPUEFy2_Z3cx0abHptQ@mail.gmail.com>
> diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
> index 5859fa68bb84..1ce13b23cf6c 100644
> --- a/fs/smb/server/smb2pdu.c
> +++ b/fs/smb/server/smb2pdu.c
> @@ -1670,10 +1670,7 @@ static int ntlm_authenticate(struct ksmbd_work *work,
>                 return -EPERM;
>         }
>
> -       /* Check for previous session */
>         prev_id = le64_to_cpu(req->PreviousSessionId);
Is there any specific reason for not moving this line together?

> -       if (prev_id && prev_id != sess->id)
> -               destroy_previous_session(conn, user, prev_id);
>
>         if (sess->state == SMB2_SESSION_VALID) {
>                 /*
> @@ -1712,6 +1709,9 @@ static int ntlm_authenticate(struct ksmbd_work *work,
>                 }
>         }
>
> +       if (prev_id && prev_id != sess->id)
> +               destroy_previous_session(conn, sess->user, prev_id);
> +
>         /*
>          * If session state is SMB2_SESSION_VALID, We can assume
>          * that it is reauthentication. And the user/password
> --
> 2.47.3
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.