Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
To: shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] [CIFS] [1/4] NTLM authentication and signing - Calculate auth response per smb session
Date: Wed, 13 Oct 2010 08:36:42 -0400	[thread overview]
Message-ID: <20101013083642.74d9b8a9@corrin.poochiereds.net> (raw)
In-Reply-To: <1286912703-22661-1-git-send-email-shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tue, 12 Oct 2010 14:45:03 -0500
shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:

> From: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Start calculation auth response within a session.  Move/Add pertinet
> data structures like session key, server challenge and ntlmv2_hash in
> a session structure.  We should do the calculations within a session
> before copying session key and response over to server data
> structures because a session setup can fail.
> 
> Only after a very first smb session succeeds, it copies/makes its
> session key, session key of smb connection.  This key stays with
> the smb connection throughout its life.
> 
> 
> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>


>  		bcc_ptr += CIFS_SESS_KEY_SIZE;
>  		if (ses->capabilities & CAP_UNICODE) {
> @@ -3175,6 +3176,15 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *ses,
>  	if (rc) {
>  		cERROR(1, "Send error in SessSetup = %d", rc);
>  	} else {
> +		mutex_lock(&ses->server->srv_mutex);
> +		if (!server->session_estab) {
> +			memcpy(&server->session_key.data,
> +				&ses->auth_key.data, ses->auth_key.len);
> +			server->session_key.len = ses->auth_key.len;
> +			ses->server->session_estab = true;
			^^^^
			nit: Aren't "server" and "ses->server" the
			same? Why access them differently here?

> +		}
> +		mutex_unlock(&server->srv_mutex);
> +
		^^^^^^
		What are the rules for locking around the session_estab
		flag? Here you're holding the srv_mutex when checking
		and altering it, but in cifs_reconnect you're altering
		it without holding the mutex. Is that a potential race
		condition?

>  		cFYI(1, "CIFS Session Established successfully");
>  		spin_lock(&GlobalMid_Lock);
>  		ses->status = CifsGood;

-- 
Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>

  parent reply	other threads:[~2010-10-13 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 19:45 [PATCH] [CIFS] [1/4] NTLM authentication and signing - Calculate auth response per smb session shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <1286912703-22661-1-git-send-email-shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-10-13 12:36   ` Jeff Layton [this message]
     [not found]     ` <20101013083642.74d9b8a9-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-10-13 15:28       ` Shirish Pargaonkar
     [not found]         ` <AANLkTik_bqHOsOn1UpgWECu-x=cZgVKUt4HAgWRi-z7W-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-13 17:03           ` Jeff Layton
     [not found]             ` <20101013130345.41bb7e85-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-10-13 18:08               ` Shirish Pargaonkar
2010-10-13 18:42               ` Shirish Pargaonkar
     [not found]                 ` <AANLkTikLp9BH6_vgkebkKWDJrwLSo4X=u08xTEoAnAuR-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-13 18:47                   ` Jeff Layton
     [not found]                     ` <20101013144755.03741ac2-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-10-13 19:24                       ` Shirish Pargaonkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101013083642.74d9b8a9@corrin.poochiereds.net \
    --to=jlayton-eunubhrolfbytjvyw6ydsg@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox