[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFBCWQJAjef4AGXmVDZ-dR02zqstpXuP_mWimsF5HQCMxxeCcg@mail.gmail.com>
Date: Fri, 19 Apr 2024 16:09:56 +0700
From: Ammar Faizi <ammarfaizi2@...weeb.org>
To: hexue <xue01.he@...sung.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
io-uring Mailing List <io-uring@...r.kernel.org>, Jens Axboe <axboe@...nel.dk>,
Pavel Begunkov <asml.silence@...il.com>, Kanchan Joshi <joshi.k@...sung.com>,
Kundan Kumar <kundan.kumar@...sung.com>, Anuj Gupta <anuj20.g@...sung.com>,
Wenwen Chen <wenwen.chen@...sung.com>, Ruyi Zhang <ruyi.zhang@...sung.com>,
Xiaobing Li <xiaobing.li@...sung.com>, cliang01.li@...sung.com, peiwei.li@...sung.com
Subject: Re: [PATCH v2] io_uring: releasing CPU resources when polling
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
Powered by blists - more mailing lists