diff options
| author | Jiri Kosina <[email protected]> | 2022-01-10 09:56:57 +0100 |
|---|---|---|
| committer | Jiri Kosina <[email protected]> | 2022-01-10 09:56:57 +0100 |
| commit | 3551a3ff8229e15d2a4b47b8234923bc72da65ef (patch) | |
| tree | a62465753397b0268529a5d0b9ab43a8840069ad /drivers/dma/idxd/submit.c | |
| parent | 906095af85e8b2e53ee9f8c50b3dff365aa09df8 (diff) | |
| parent | 33a5c2793451770cb6dcf0cc35c76cfd4b045513 (diff) | |
Merge branch 'for-5.17/letsketch' into for-linus
- new driver to support for LetSketch device (Hans de Goede)
Diffstat (limited to 'drivers/dma/idxd/submit.c')
| -rw-r--r-- | drivers/dma/idxd/submit.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c index de76fb4abac2..83452fbbb168 100644 --- a/drivers/dma/idxd/submit.c +++ b/drivers/dma/idxd/submit.c @@ -106,6 +106,7 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, { struct idxd_desc *d, *t, *found = NULL; struct llist_node *head; + LIST_HEAD(flist); desc->completion->status = IDXD_COMP_DESC_ABORT; /* @@ -120,7 +121,11 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, found = desc; continue; } - list_add_tail(&desc->list, &ie->work_list); + + if (d->completion->status) + list_add_tail(&d->list, &flist); + else + list_add_tail(&d->list, &ie->work_list); } } @@ -130,6 +135,17 @@ static void llist_abort_desc(struct idxd_wq *wq, struct idxd_irq_entry *ie, if (found) complete_desc(found, IDXD_COMPLETE_ABORT); + + /* + * complete_desc() will return desc to allocator and the desc can be + * acquired by a different process and the desc->list can be modified. + * Delete desc from list so the list trasversing does not get corrupted + * by the other process. + */ + list_for_each_entry_safe(d, t, &flist, list) { + list_del_init(&d->list); + complete_desc(d, IDXD_COMPLETE_NORMAL); + } } int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) |