mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-01 02:33:01 +09:00
rxe: Fix a sleep-in-atomic bug in post_one_send
[ Upstream commit 07d432bb97 ]
The driver may sleep under a spin lock, and the function call path is:
post_one_send (acquire the lock by spin_lock_irqsave)
init_send_wqe
copy_from_user --> may sleep
There is no flow that makes "qp->is_user" true, and copy_from_user may
cause bug when a non-user pointer is used. So the lines of copy_from_user
and check of "qp->is_user" are removed.
Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0da0e51729
commit
e7d5fa96ef
@@ -729,13 +729,8 @@ static int init_send_wqe(struct rxe_qp *qp, struct ib_send_wr *ibwr,
|
||||
|
||||
sge = ibwr->sg_list;
|
||||
for (i = 0; i < num_sge; i++, sge++) {
|
||||
if (qp->is_user && copy_from_user(p, (__user void *)
|
||||
(uintptr_t)sge->addr, sge->length))
|
||||
return -EFAULT;
|
||||
|
||||
else if (!qp->is_user)
|
||||
memcpy(p, (void *)(uintptr_t)sge->addr,
|
||||
sge->length);
|
||||
memcpy(p, (void *)(uintptr_t)sge->addr,
|
||||
sge->length);
|
||||
|
||||
p += sge->length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user