public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jgg@ziepe.ca
Cc: kvm@vger.kernel.org
Subject: [bug report] vfio/mtty: Convert to use vfio_register_group_dev()
Date: Fri, 25 Jun 2021 11:20:44 +0300	[thread overview]
Message-ID: <YNWR3PwALrq98NNU@mwanda> (raw)

Hello Jason Gunthorpe,

The patch 09177ac91921: "vfio/mtty: Convert to use
vfio_register_group_dev()" from Jun 17, 2021, leads to the following
static checker warning:

	samples/vfio-mdev/mtty.c:742 mtty_probe()
	warn: '&mdev_state->next' not removed from list

samples/vfio-mdev/mtty.c
   730  
   731          mutex_init(&mdev_state->ops_lock);
   732          mdev_state->mdev = mdev;
   733  
   734          mtty_create_config_space(mdev_state);
   735  
   736          mutex_lock(&mdev_list_lock);
   737          list_add(&mdev_state->next, &mdev_devices_list);
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   738          mutex_unlock(&mdev_list_lock);
   739  
   740          ret = vfio_register_group_dev(&mdev_state->vdev);
   741          if (ret) {
   742                  kfree(mdev_state);
                              ^^^^^^^^^^
This is still on the list so it will lead to a user after free.

   743                  return ret;
   744          }
   745          dev_set_drvdata(&mdev->dev, mdev_state);
   746          return 0;

regards,
dan carpenter

                 reply	other threads:[~2021-06-25  8:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=YNWR3PwALrq98NNU@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=kvm@vger.kernel.org \
    /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