All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: protect updating server->dstaddr with a spinlock
@ 2020-04-21  2:37 Ronnie Sahlberg
  2020-04-21 10:04 ` Jeff Layton
  2020-04-21 15:04 ` Steve French
  0 siblings, 2 replies; 3+ messages in thread
From: Ronnie Sahlberg @ 2020-04-21  2:37 UTC (permalink / raw)
  To: linux-cifs; +Cc: Ronnie Sahlberg

We use a spinlock while we are reading and accessing the destination address for a server.
We need to also use this spinlock to protect when we are modifying this adress from
reconn_set_ipaddr().

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/connect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 95b3ab0ca8c0..63830f228b4a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -375,8 +375,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
 		return rc;
 	}
 
+	spin_lock(&cifs_tcp_ses_lock);
 	rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
 				  strlen(ipaddr));
+	spin_unlock(&cifs_tcp_ses_lock);
 	kfree(ipaddr);
 
 	return !rc ? -1 : 0;
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: protect updating server->dstaddr with a spinlock
  2020-04-21  2:37 [PATCH] cifs: protect updating server->dstaddr with a spinlock Ronnie Sahlberg
@ 2020-04-21 10:04 ` Jeff Layton
  2020-04-21 15:04 ` Steve French
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2020-04-21 10:04 UTC (permalink / raw)
  To: Ronnie Sahlberg, linux-cifs

On Tue, 2020-04-21 at 12:37 +1000, Ronnie Sahlberg wrote:
> We use a spinlock while we are reading and accessing the destination address for a server.
> We need to also use this spinlock to protect when we are modifying this adress from
> reconn_set_ipaddr().
> 
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/connect.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 95b3ab0ca8c0..63830f228b4a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -375,8 +375,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
>  		return rc;
>  	}
>  
> +	spin_lock(&cifs_tcp_ses_lock);
>  	rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
>  				  strlen(ipaddr));
> +	spin_unlock(&cifs_tcp_ses_lock);
>  	kfree(ipaddr);
>  
>  	return !rc ? -1 : 0;

Reviewed-by: Jeff Layton <jlayton@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: protect updating server->dstaddr with a spinlock
  2020-04-21  2:37 [PATCH] cifs: protect updating server->dstaddr with a spinlock Ronnie Sahlberg
  2020-04-21 10:04 ` Jeff Layton
@ 2020-04-21 15:04 ` Steve French
  1 sibling, 0 replies; 3+ messages in thread
From: Steve French @ 2020-04-21 15:04 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: linux-cifs

merged into cifs-2.6.git for-next

On Mon, Apr 20, 2020 at 9:38 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> We use a spinlock while we are reading and accessing the destination address for a server.
> We need to also use this spinlock to protect when we are modifying this adress from
> reconn_set_ipaddr().
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/connect.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 95b3ab0ca8c0..63830f228b4a 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -375,8 +375,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
>                 return rc;
>         }
>
> +       spin_lock(&cifs_tcp_ses_lock);
>         rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
>                                   strlen(ipaddr));
> +       spin_unlock(&cifs_tcp_ses_lock);
>         kfree(ipaddr);
>
>         return !rc ? -1 : 0;
> --
> 2.13.6
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-21 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  2:37 [PATCH] cifs: protect updating server->dstaddr with a spinlock Ronnie Sahlberg
2020-04-21 10:04 ` Jeff Layton
2020-04-21 15:04 ` Steve French

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.