Skip to content

Commit 607b146

Browse files
Farah-kassabriogabbay
authored andcommitted
habanalabs: cannot sleep while holding spinlock
Fix 2 areas in the code where it's possible the code will go to sleep while holding a spinlock. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: farah kassabri <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent 698f744 commit 607b146

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

drivers/misc/habanalabs/common/command_buffer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ int hl_cb_create(struct hl_device *hdev, struct hl_cb_mgr *mgr,
314314

315315
spin_lock(&mgr->cb_lock);
316316
rc = idr_alloc(&mgr->cb_handles, cb, 1, 0, GFP_ATOMIC);
317-
if (rc < 0)
318-
rc = idr_alloc(&mgr->cb_handles, cb, 1, 0, GFP_KERNEL);
319317
spin_unlock(&mgr->cb_lock);
320318

321319
if (rc < 0) {

drivers/misc/habanalabs/common/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
124124

125125
spin_lock(&vm->idr_lock);
126126
handle = idr_alloc(&vm->phys_pg_pack_handles, phys_pg_pack, 1, 0,
127-
GFP_KERNEL);
127+
GFP_ATOMIC);
128128
spin_unlock(&vm->idr_lock);
129129

130130
if (handle < 0) {

0 commit comments

Comments
 (0)