summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2020-04-21 04:37:39 +0200
committerSteve French <stfrench@microsoft.com>2020-04-21 16:57:56 +0200
commitfada37f6f62995cc449b36ebba1220594bfe55fe (patch)
tree6fac556247de3c9ed0dd6bba0a609b3f401aabc4
parentLinux 5.7-rc2 (diff)
downloadlinux-fada37f6f62995cc449b36ebba1220594bfe55fe.tar.xz
linux-fada37f6f62995cc449b36ebba1220594bfe55fe.zip
cifs: protect updating server->dstaddr with a spinlock
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 address from reconn_set_ipaddr(). Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/cifs/connect.c2
1 files changed, 2 insertions, 0 deletions
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;