Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: idxd: fix abort status check

Coverity static analysis of linux-next found issue.

The check (status == IDXD_COMP_DESC_ABORT) is always false since status
was previously masked with 0x7f and IDXD_COMP_DESC_ABORT is 0xff.

Fixes: 6b4b87f2c31a ("dmaengine: idxd: fix submission race window")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/162698465160.3560828.18173186265683415384.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Dave Jiang and committed by
Vinod Koul
b60bb6e2 125d1037

+10 -2
+10 -2
drivers/dma/idxd/irq.c
··· 194 194 u8 status = desc->completion->status & DSA_COMP_STATUS_MASK; 195 195 196 196 if (status) { 197 - if (unlikely(status == IDXD_COMP_DESC_ABORT)) { 197 + /* 198 + * Check against the original status as ABORT is software defined 199 + * and 0xff, which DSA_COMP_STATUS_MASK can mask out. 200 + */ 201 + if (unlikely(desc->completion->status == IDXD_COMP_DESC_ABORT)) { 198 202 complete_desc(desc, IDXD_COMPLETE_ABORT); 199 203 (*processed)++; 200 204 continue; ··· 254 250 list_for_each_entry(desc, &flist, list) { 255 251 u8 status = desc->completion->status & DSA_COMP_STATUS_MASK; 256 252 257 - if (unlikely(status == IDXD_COMP_DESC_ABORT)) { 253 + /* 254 + * Check against the original status as ABORT is software defined 255 + * and 0xff, which DSA_COMP_STATUS_MASK can mask out. 256 + */ 257 + if (unlikely(desc->completion->status == IDXD_COMP_DESC_ABORT)) { 258 258 complete_desc(desc, IDXD_COMPLETE_ABORT); 259 259 continue; 260 260 }