RE: [PATCH][RFC] dmaengine: idxd: Fix possible Use-After-Free in irq_process_work_list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I think when the description is freed, it maybe used again because of race, then
> it's next maybe pointer a value that should not be freed
> 
> To prevent this, list_for_each_entry_safe should be used.
> 

Rewrite the commit header:

    dmaengine: idxd: Fix possible Use-After-Free in irq_process_work_list

    The description has been freed in idxd_desc_complete(), should not be used
    in iteration, so replace list_for_each_entry with list_for_each_entry_safe
    to prevent the accessing

    Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>


> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> ---
>  drivers/dma/idxd/irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index
> 8dc029c..0c7fed7 100644
> --- a/drivers/dma/idxd/irq.c
> +++ b/drivers/dma/idxd/irq.c
> @@ -611,7 +611,7 @@ static void irq_process_work_list(struct idxd_irq_entry
> *irq_entry)
> 
>  	spin_unlock(&irq_entry->list_lock);
> 
> -	list_for_each_entry(desc, &flist, list) {
> +	list_for_each_entry_safe(desc, n, &flist, list) {
>  		/*
>  		 * Check against the original status as ABORT is software defined
>  		 * and 0xff, which DSA_COMP_STATUS_MASK can mask out.
> --
> 2.9.4






[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux