summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorHåkon Bugge <haakon.bugge@oracle.com>2021-06-22 15:39:57 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:56:28 +0200
commitc764f2d899b26eb2001358498eea5b1df031c18e (patch)
tree072635503fd8bb674b71dcec10b63b762190b7e4 /include/net
parentd52ceed8452614c46dcdb701c1386902d09a1cfa (diff)
downloadlinux-stable-c764f2d899b26eb2001358498eea5b1df031c18e.tar.gz
linux-stable-c764f2d899b26eb2001358498eea5b1df031c18e.tar.bz2
linux-stable-c764f2d899b26eb2001358498eea5b1df031c18e.zip
RDMA/cma: Protect RMW with qp_mutex
[ Upstream commit ca0c448d2b9f43e3175835d536853854ef544e22 ] The struct rdma_id_private contains three bit-fields, tos_set, timeout_set, and min_rnr_timer_set. These are set by accessor functions without any synchronization. If two or all accessor functions are invoked in close proximity in time, there will be Read-Modify-Write from several contexts to the same variable, and the result will be intermittent. Fixed by protecting the bit-fields by the qp_mutex in the accessor functions. The consumer of timeout_set and min_rnr_timer_set is in rdma_init_qp_attr(), which is called with qp_mutex held for connected QPs. Explicit locking is added for the consumers of tos and tos_set. This commit depends on ("RDMA/cma: Remove unnecessary INIT->INIT transition"), since the call to rdma_init_qp_attr() from cma_init_conn_qp() does not hold the qp_mutex. Fixes: 2c1619edef61 ("IB/cma: Define option to set ack timeout and pack tos_set") Fixes: 3aeffc46afde ("IB/cma: Introduce rdma_set_min_rnr_timer()") Link: https://lore.kernel.org/r/1624369197-24578-3-git-send-email-haakon.bugge@oracle.com Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
0 files changed, 0 insertions, 0 deletions