summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2020-04-21 12:37:39 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-10 10:30:09 +0200
commit6c662c519277d9d94f4d146b7c05e67a426b91a7 (patch)
treecc9509c2a7018a598ae403cec7bb4657b1b815e9 /fs
parent1137dfe0cb482de5c8fa38d8f6bf0288d0ea7e9d (diff)
downloadlinux-stable-6c662c519277d9d94f4d146b7c05e67a426b91a7.tar.gz
linux-stable-6c662c519277d9d94f4d146b7c05e67a426b91a7.tar.bz2
linux-stable-6c662c519277d9d94f4d146b7c05e67a426b91a7.zip
cifs: protect updating server->dstaddr with a spinlock
[ Upstream commit fada37f6f62995cc449b36ebba1220594bfe55fe ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-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 975f800b9dd4..9e569d60c636 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -353,8 +353,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;