1
0
Fork 0

cifs: protect updating server->dstaddr with a spinlock

[ Upstream commit fada37f6f6 ]

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>
5.4-rM2-2.2.x-imx-squashed
Ronnie Sahlberg 2020-04-21 12:37:39 +10:00 committed by Greg Kroah-Hartman
parent 0560b7c3ba
commit b31e0bd4a9
1 changed files with 2 additions and 0 deletions

View File

@ -371,8 +371,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;