The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Sven Peter <sven@svenpeter.dev>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Janne Grunau <j@jannau.net>, Asahi Lina <lina@asahilina.net>,
	Jens Axboe <axboe@kernel.dk>,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
	Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] soc: apple: rtkit: Fix use-after-free in apple_rtkit_crashlog_rx()
Date: Tue, 18 Feb 2025 21:31:11 +0530	[thread overview]
Message-ID: <6c965dbc-9f01-414a-b218-2fa88155eb52@oracle.com> (raw)
In-Reply-To: <0e609fea-48b0-4b39-aae4-90395a782ed8@app.fastmail.com>

Hi,

On 18/02/25 21:04, Sven Peter wrote:
> Hi,
> 
> 
> On Wed, Feb 12, 2025, at 09:58, Harshit Mogalapalli wrote:
>> This code calls kfree(bfr); and then passes "bfr" to rtk->ops->crashed()
>> which is a use after free.  The ->crashed function pointer is implemented
>> by apple_nvme_rtkit_crashed() and it doesn't use the "bfr" pointer so
>> this doesn't cause a problem.  But it still looks sketchy as can be.
>>
>> Fix this by moving kfree() after the last usage of bfr.
>>
>> Fixes: c559645f343a ("soc: apple: rtkit: Pass the crashlog to the
>> crashed() callback")
> 
> This commit isn't upstream yet afaict, did you mean to post a review comment
> to [1] instead?
> 

I made the patch based on linux-next, linux-next has the patch merged.

Thanks,
Harshit
> 
> [1] https://lore.kernel.org/asahi/20250202-rtkit-crashdump-v1-1-9d38615b4e12@asahilina.net/
> 
> 
> Best,
> 
> 
> Sven


  reply	other threads:[~2025-02-18 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12  8:58 [PATCH] soc: apple: rtkit: Fix use-after-free in apple_rtkit_crashlog_rx() Harshit Mogalapalli
2025-02-12 10:00 ` Eric Curtin
2025-02-18 15:34 ` Sven Peter
2025-02-18 16:01   ` Harshit Mogalapalli [this message]
2025-02-18 17:02     ` Sven Peter
2025-02-18 17:05 ` Sven Peter

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=6c965dbc-9f01-414a-b218-2fa88155eb52@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=axboe@kernel.dk \
    --cc=dan.carpenter@linaro.org \
    --cc=error27@gmail.com \
    --cc=j@jannau.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lina@asahilina.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sven@svenpeter.dev \
    /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