All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Nir Levy <bhr166@gmail.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org
Subject: Re: [PATCH] atm: Fix use-after-free bug in atm_dev_register()
Date: Mon, 5 Dec 2022 18:08:42 -0800	[thread overview]
Message-ID: <20221205180842.014cd7e9@kernel.org> (raw)
In-Reply-To: <CAJey7buiiSqO+tXDUYDTue6Hy06Jbyo5yeaGBeBz5b8wLiW+pQ@mail.gmail.com>

On Tue, 6 Dec 2022 00:08:32 +0200 Nir Levy wrote:
> From 5cb38a02b10a2f52bf7f7eef67fa4abc0974b21b Mon Sep 17 00:00:00 2001
> From: Nir Levy <bhr166@gmail.com>
> Date: Fri, 25 Nov 2022 21:06:48 +0200
> Subject: [PATCH net] net: atm: Fix use-after-free bug in atm_dev_register()
> 
> When device_register() return failed in atm_register_sysfs,
> the program will return to atm_dev_register and will kfree
> the device. As the comment of device_register() says,
> put_device() needs to be used to give up the reference
> in the error path. Using kfree instead triggers a UAF,
> as shown by the following KASAN report, obtained by causing
> device_register() to fail. This patch calls put_device
> when atm_register_sysfs has failed, and call kfree
> only when atm_proc_dev_register has failed.

Please make a fresh submission, it doesn't have to be in the same
thread (in fact that's discouraged).

      parent reply	other threads:[~2022-12-06  2:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-03 11:09 [PATCH] atm: Fix use-after-free bug in atm_dev_register() Nir Levy
2022-12-05  7:04 ` Leon Romanovsky
     [not found]   ` <CAJey7buiiSqO+tXDUYDTue6Hy06Jbyo5yeaGBeBz5b8wLiW+pQ@mail.gmail.com>
2022-12-06  2:08     ` Jakub Kicinski [this message]

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=20221205180842.014cd7e9@kernel.org \
    --to=kuba@kernel.org \
    --cc=bhr166@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=leon@kernel.org \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.