Skip to content

Commit

Permalink
RDMA/siw: Add missing rtnl_lock around access to ifa
Browse files Browse the repository at this point in the history
ifa is protected by rcu or rtnl, add the missing locking. In this case we
have to use rtnl since siw_listen_address() is sleeping.

Fixes: 6c52fdc ("rdma/siw: connection management")
Reviewed-by: Bernard Metzler <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
  • Loading branch information
jgunthorpe committed Jul 11, 2019
1 parent 775a41e commit c421651
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/infiniband/sw/siw/siw_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port),
&s_raddr->sin_addr, ntohs(s_raddr->sin_port));

rtnl_lock();
for_ifa(in_dev)
{
if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) ||
Expand All @@ -1989,6 +1990,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog)
}
}
endfor_ifa(in_dev);
rtnl_unlock();
in_dev_put(in_dev);
} else if (id->local_addr.ss_family == AF_INET6) {
struct inet6_dev *in6_dev = in6_dev_get(dev);
Expand Down

0 comments on commit c421651

Please sign in to comment.