提交 68373132 编写于 作者: R Ronnie Sahlberg 提交者: Yang Yingliang

cifs: protect updating server->dstaddr with a spinlock

stable inclusion
from linux-4.19.122
commit 6c662c519277d9d94f4d146b7c05e67a426b91a7

--------------------------------

[ Upstream commit fada37f6 ]

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: NRonnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: NJeff Layton <jlayton@kernel.org>
Signed-off-by: NSteve French <stfrench@microsoft.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 cbd9fe2a
...@@ -353,8 +353,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server) ...@@ -353,8 +353,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
return rc; return rc;
} }
spin_lock(&cifs_tcp_ses_lock);
rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr, rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
strlen(ipaddr)); strlen(ipaddr));
spin_unlock(&cifs_tcp_ses_lock);
kfree(ipaddr); kfree(ipaddr);
return !rc ? -1 : 0; return !rc ? -1 : 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册