From: Ronnie Sahlberg Date: Tue, 21 Apr 2020 02:37:39 +0000 (+1000) Subject: cifs: protect updating server->dstaddr with a spinlock X-Git-Tag: v4.9.223~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f9b0d0f1903a874dc821d8981443c480bd30837;p=platform%2Fkernel%2Flinux-amlogic.git 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 Reviewed-by: Jeff Layton Signed-off-by: Steve French Signed-off-by: Sasha Levin --- diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f2707ff..c018d16 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -341,8 +341,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;