]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/rxe: Prevent access to wr->next ptr afrer wr is posted to send queue
authorMikhail Malygin <m.malygin@yadro.com>
Thu, 16 Jul 2020 19:03:41 +0000 (22:03 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 16 Jul 2020 19:12:07 +0000 (16:12 -0300)
commitd60be4cbeb39dad9a94ae043c85e5470544336d2
tree2f7c90bd0a4fa60f203de58ba9166447daf9116c
parent1053a83d615aa2388f7e6815b390ab7d082619ed
RDMA/rxe: Prevent access to wr->next ptr afrer wr is posted to send queue

rxe_post_send_kernel() iterates over linked list of wr's, until the
wr->next ptr is NULL.  However if we've got an interrupt after last wr is
posted, control may be returned to the code after send completion callback
is executed and wr memory is freed.

As a result, wr->next pointer may contain incorrect value leading to
panic. Store the wr->next on the stack before posting it.

Fixes: 5deaf88696f1 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20200716190340.23453-1-m.malygin@yadro.com
Signed-off-by: Mikhail Malygin <m.malygin@yadro.com>
Signed-off-by: Sergey Kojushev <s.kojushev@yadro.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_verbs.c