Skip to content

Commit b31e0bd

Browse files
Ronnie Sahlberggregkh
authored andcommitted
cifs: protect updating server->dstaddr with a spinlock
[ Upstream commit fada37f ] 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>
1 parent 0560b7c commit b31e0bd

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/cifs/connect.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
371371
return rc;
372372
}
373373

374+
spin_lock(&cifs_tcp_ses_lock);
374375
rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
375376
strlen(ipaddr));
377+
spin_unlock(&cifs_tcp_ses_lock);
376378
kfree(ipaddr);
377379

378380
return !rc ? -1 : 0;

0 commit comments

Comments
 (0)