public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: hexue <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>,
	 io-uring Mailing List <[email protected]>,
	Jens Axboe <[email protected]>,
	 Pavel Begunkov <[email protected]>,
	Kanchan Joshi <[email protected]>,
	 Kundan Kumar <[email protected]>,
	Anuj Gupta <[email protected]>,
	 Wenwen Chen <[email protected]>,
	Ruyi Zhang <[email protected]>,
	 Xiaobing Li <[email protected]>,
	[email protected], [email protected]
Subject: Re: [PATCH v2] io_uring: releasing CPU resources when polling
Date: Fri, 19 Apr 2024 16:09:56 +0700	[thread overview]
Message-ID: <CAFBCWQJAjef4AGXmVDZ-dR02zqstpXuP_mWimsF5HQCMxxeCcg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>

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

  reply	other threads:[~2024-04-19  9:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240418093150epcas5p31dc20cc737c72009265593f247e48262@epcas5p3.samsung.com>
2024-04-18  9:31 ` [PATCH v2] io_uring: releasing CPU resources when polling hexue
2024-04-19  9:09   ` Ammar Faizi [this message]
     [not found]     ` <CGME20240423033155epcas5p315a8e6ea0114402afafed84e5902ed6b@epcas5p3.samsung.com>
2024-04-23  3:31       ` hexue
2024-04-19 12:27   ` Pavel Begunkov
     [not found]     ` <CGME20240422081827epcas5p21ba3154cfcaa7520d7db412f5d3a15d2@epcas5p2.samsung.com>
2024-04-22  8:18       ` Re: io_uring: " hexue
2024-04-22 18:11   ` [PATCH v2] " Jens Axboe
     [not found]     ` <CGME20240423032657epcas5p4d97f377b48bd40e792d187013c5e409c@epcas5p4.samsung.com>
2024-04-23  3:26       ` hexue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFBCWQJAjef4AGXmVDZ-dR02zqstpXuP_mWimsF5HQCMxxeCcg@mail.gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox