Skip to content

Commit fada37f

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: protect updating server->dstaddr with a spinlock
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 <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent ae83d0b commit fada37f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/cifs/connect.c

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

378+
spin_lock(&cifs_tcp_ses_lock);
378379
rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
379380
strlen(ipaddr));
381+
spin_unlock(&cifs_tcp_ses_lock);
380382
kfree(ipaddr);
381383

382384
return !rc ? -1 : 0;

0 commit comments

Comments
 (0)