Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Meetakshi Setiya <meetakshisetiyaoss@gmail.com>
To: Steve French <smfrench@gmail.com>
Cc: CIFS <linux-cifs@vger.kernel.org>,
	Shyam Prasad N <nspmangalore@gmail.com>
Subject: Re: [PATCH][SMB3 client] missing lock when picking channel
Date: Fri, 26 Apr 2024 12:16:19 +0530	[thread overview]
Message-ID: <CAFTVevV=nv2-BDotSu+Y2XNFTRGkdc=rv1QFOuzA6aLorFjPsw@mail.gmail.com> (raw)
In-Reply-To: <CAH2r5ms2xmxgZ08pecifj+Za=_oWnrhVOUgifjYLnCw+Rz9_kA@mail.gmail.com>

Looks good

Thanks
Meetakshi

On Thu, Apr 25, 2024 at 10:14 PM Steve French <smfrench@gmail.com> wrote:
>
> Coverity spotted a place where we should have been holding the
> channel lock when accessing the ses channel index.
>
> Addresses-Coverity: 1582039 ("Data race condition (MISSING_LOCK)")
> Cc: stable@vger.kernel.org
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/smb/client/transport.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
> index 443b4b89431d..fc0ddc75abc9 100644
> --- a/fs/smb/client/transport.c
> +++ b/fs/smb/client/transport.c
> @@ -1059,9 +1059,11 @@ struct TCP_Server_Info
> *cifs_pick_channel(struct cifs_ses *ses)
>   index = (uint)atomic_inc_return(&ses->chan_seq);
>   index %= ses->chan_count;
>   }
> +
> + server = ses->chans[index].server;
>   spin_unlock(&ses->chan_lock);
>
> - return ses->chans[index].server;
> + return server;
>  }
>
> --
> Thanks,
>
> Steve

      parent reply	other threads:[~2024-04-26  6:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 16:44 [PATCH][SMB3 client] missing lock when picking channel Steve French
2024-04-25 16:55 ` Shyam Prasad N
2024-04-26  6:46 ` Meetakshi Setiya [this message]

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='CAFTVevV=nv2-BDotSu+Y2XNFTRGkdc=rv1QFOuzA6aLorFjPsw@mail.gmail.com' \
    --to=meetakshisetiyaoss@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=smfrench@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).