All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leif Sahlberg <lsahlber@redhat.com>
To: Paulo Alcantara <pc@cjr.nz>
Cc: CIFS <linux-cifs@vger.kernel.org>, "French, Steve" <smfrench@gmail.com>
Subject: Re: [PATCH 2/2] cifs: use correct lock type in cifs_reconnect()
Date: Thu, 21 Apr 2022 12:39:21 +1000	[thread overview]
Message-ID: <CAGvGhF7R4dyohbTg1+zVNiLpHp2x_oe3E+uFQZSr8fK0cspagA@mail.gmail.com> (raw)
In-Reply-To: <20220421000546.5129-2-pc@cjr.nz>

looks good to me.
Reviewed-by me

On Thu, Apr 21, 2022 at 10:06 AM Paulo Alcantara <pc@cjr.nz> wrote:
>
> TCP_Server_Info::origin_fullpath and TCP_Server_Info::leaf_fullpath
> are protected by refpath_lock mutex and not cifs_tcp_ses_lock
> spinlock.
>
> Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
> ---
>  fs/cifs/connect.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 2c24d433061a..42e14f408856 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -534,12 +534,19 @@ int cifs_reconnect(struct TCP_Server_Info *server, bool mark_smb_session)
>  {
>         /* If tcp session is not an dfs connection, then reconnect to last target server */
>         spin_lock(&cifs_tcp_ses_lock);
> -       if (!server->is_dfs_conn || !server->origin_fullpath || !server->leaf_fullpath) {
> +       if (!server->is_dfs_conn) {
>                 spin_unlock(&cifs_tcp_ses_lock);
>                 return __cifs_reconnect(server, mark_smb_session);
>         }
>         spin_unlock(&cifs_tcp_ses_lock);
>
> +       mutex_lock(&server->refpath_lock);
> +       if (!server->origin_fullpath || !server->leaf_fullpath) {
> +               mutex_unlock(&server->refpath_lock);
> +               return __cifs_reconnect(server, mark_smb_session);
> +       }
> +       mutex_unlock(&server->refpath_lock);
> +
>         return reconnect_dfs_server(server);
>  }
>  #else
> --
> 2.35.3
>


  reply	other threads:[~2022-04-21  2:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  0:05 [PATCH 1/2] cifs: fix NULL ptr dereference in refresh_mounts() Paulo Alcantara
2022-04-21  0:05 ` [PATCH 2/2] cifs: use correct lock type in cifs_reconnect() Paulo Alcantara
2022-04-21  2:39   ` Leif Sahlberg [this message]
2022-04-21  3:56     ` Steve French
2022-04-21  2:38 ` [PATCH 1/2] cifs: fix NULL ptr dereference in refresh_mounts() Leif Sahlberg
2022-04-21  3:55   ` Steve French

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=CAGvGhF7R4dyohbTg1+zVNiLpHp2x_oe3E+uFQZSr8fK0cspagA@mail.gmail.com \
    --to=lsahlber@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@cjr.nz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.