Repository navigation
Commit c764f2d
RDMA/cma: Protect RMW with qp_mutex
[ Upstream commit ca0c448 ]
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: 2c1619e ("IB/cma: Define option to set ack timeout and pack tos_set")
Fixes: 3aeffc4 ("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>1 parent d52ceed commit c764f2d
1 file changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2476 | 2476 | | |
2477 | 2477 | | |
2478 | 2478 | | |
| 2479 | + | |
2479 | 2480 | | |
2480 | 2481 | | |
| 2482 | + | |
2481 | 2483 | | |
2482 | 2484 | | |
2483 | 2485 | | |
| |||
2537 | 2539 | | |
2538 | 2540 | | |
2539 | 2541 | | |
| 2542 | + | |
2540 | 2543 | | |
2541 | 2544 | | |
| 2545 | + | |
2542 | 2546 | | |
2543 | 2547 | | |
2544 | 2548 | | |
| |||
2585 | 2589 | | |
2586 | 2590 | | |
2587 | 2591 | | |
| 2592 | + | |
2588 | 2593 | | |
2589 | 2594 | | |
| 2595 | + | |
2590 | 2596 | | |
2591 | 2597 | | |
2592 | 2598 | | |
| |||
2613 | 2619 | | |
2614 | 2620 | | |
2615 | 2621 | | |
| 2622 | + | |
2616 | 2623 | | |
2617 | 2624 | | |
| 2625 | + | |
2618 | 2626 | | |
2619 | 2627 | | |
2620 | 2628 | | |
| |||
3000 | 3008 | | |
3001 | 3009 | | |
3002 | 3010 | | |
3003 | | - | |
| 3011 | + | |
3004 | 3012 | | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
3005 | 3016 | | |
3006 | 3017 | | |
3007 | 3018 | | |
| |||
3048 | 3059 | | |
3049 | 3060 | | |
3050 | 3061 | | |
| 3062 | + | |
3051 | 3063 | | |
3052 | 3064 | | |
| 3065 | + | |
3053 | 3066 | | |
3054 | 3067 | | |
3055 | 3068 | | |
| |||
4073 | 4086 | | |
4074 | 4087 | | |
4075 | 4088 | | |
| 4089 | + | |
4076 | 4090 | | |
4077 | 4091 | | |
| 4092 | + | |
| 4093 | + | |
4078 | 4094 | | |
4079 | 4095 | | |
4080 | 4096 | | |
| |||
0 commit comments