Re: [PATCH v2] io_uring: releasing CPU resources when polling

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

 



On Fri, Apr 19, 2024 at 3:47 PM hexue wrote:
> +void init_hybrid_poll_info(struct io_ring_ctx *ctx, struct io_kiocb *req)
> +{
> +       u32 index;
> +
> +       index = req->file->f_inode->i_rdev;
> +       struct iopoll_info *entry = xa_load(&ctx->poll_array, index);
> +
> +       if (!entry) {
> +               entry = kmalloc(sizeof(struct iopoll_info), GFP_KERNEL);
> +               entry->last_runtime = 0;
> +               entry->last_irqtime = 0;
> +               xa_store(&ctx->poll_array, index, entry, GFP_KERNEL);
> +       }

GFP_KERNEL may fail; you must check for failure. Otherwise, it could
lead to NULL pointer dereference.

-- 
Ammar Faizi





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux