diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2020-04-21 05:37:39 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-10 11:29:00 +0300 |
commit | 4c49cf3581b920745afc0650613a676dbb81ef60 (patch) | |
tree | 10c0cd2c00f2867d76782fd5dd066330a597fb3c /fs/cifs/connect.c | |
parent | 88d82debb1f094ba34382e2f5a9b0c8a1facb671 (diff) | |
download | linux-4c49cf3581b920745afc0650613a676dbb81ef60.tar.xz |
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/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 697edc92dff2..58e7288e5151 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -348,8 +348,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; |