public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dan Carpenter <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [bug report] io_uring: free io_buffer_list entries via RCU
Date: Tue, 5 Dec 2023 15:36:51 +0300	[thread overview]
Message-ID: <[email protected]> (raw)

Hello Jens Axboe,

This is a semi-automatic email about new static checker warnings.

The patch 5cf4f52e6d8a: "io_uring: free io_buffer_list entries via 
RCU" from Nov 27, 2023, leads to the following Smatch complaint:

    io_uring/kbuf.c:766 io_pbuf_get_address()
    warn: variable dereferenced before check 'bl' (see line 764)

io_uring/kbuf.c
   753  void *io_pbuf_get_address(struct io_ring_ctx *ctx, unsigned long bgid)
   754  {
   755          struct io_buffer_list *bl;
   756  
   757          bl = __io_buffer_get_list(ctx, smp_load_acquire(&ctx->io_bl), bgid);
   758  
   759          /*
   760           * Ensure the list is fully setup. Only strictly needed for RCU lookup
   761           * via mmap, and in that case only for the array indexed groups. For
   762           * the xarray lookups, it's either visible and ready, or not at all.
   763           */
   764          if (!smp_load_acquire(&bl->is_ready))
                                      ^^^^^
bl dereferenced here

   765                  return NULL;
   766          if (!bl || !bl->is_mmap)
                    ^^^
Checked for NULL too late.

   767                  return NULL;
   768  
   769          return bl->buf_ring;
   770  }

regards,
dan carpenter

             reply	other threads:[~2023-12-05 12:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 12:36 Dan Carpenter [this message]
2023-12-05 14:01 ` [bug report] io_uring: free io_buffer_list entries via RCU Jens Axboe

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=9a411872-46c3-4652-8704-d1610f547583@moroto.mountain \
    [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