From: Phillip Potter <phil@philpotter.co.uk>
To: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Cc: linux-kernel@vger.kernel.org, Phillip Potter <phil@philpotter.co.uk>
Subject: Re: [PATCH] cdrom: fix stack leak in cdrom_ioctl_read_tochdr
Date: Fri, 7 Aug 2026 09:22:46 +0100 [thread overview]
Message-ID: <anWV1knxFy5PRvex@equinox> (raw)
In-Reply-To: <20260804132413.11837-1-sreekuttan2156239@gmail.com>
On Tue, Aug 04, 2026 at 01:24:13PM +0000, Sreeraj S Kurup wrote:
> The 'header' structure is allocated on the stack and copied
> to userspace using copy_to_user(). Uninitialized fields and
> internal struct padding can leak random kernel stack data to
> userspace processes, creating an information disclosure
> vulnerability.
>
> Initialize 'header' to zero when declaring it so that all
> fields and padding bytes are fully cleared before copying
> to userspace.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
> ---
> drivers/cdrom/cdrom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index 4f1fd389260f..f8c8dd4efa6c 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -2629,7 +2629,7 @@ static int cdrom_ioctl_get_subchnl(struct cdrom_device_info *cdi,
> static int cdrom_ioctl_read_tochdr(struct cdrom_device_info *cdi,
> void __user *argp)
> {
> - struct cdrom_tochdr header;
> + struct cdrom_tochdr header = {};
> int ret;
>
> /* cd_dbg(CD_DO_IOCTL, "entering CDROMREADTOCHDR\n"); */
> --
> 2.54.0
>
Hi Sreeraj,
Thank you for this and your other patch. I will review and build/test
these over the weekend and come back to you.
Regards,
Phil
prev parent reply other threads:[~2026-08-07 8:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 13:24 [PATCH] cdrom: fix stack leak in cdrom_ioctl_read_tochdr Sreeraj S Kurup
2026-08-07 8:22 ` Phillip Potter [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=anWV1knxFy5PRvex@equinox \
--to=phil@philpotter.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=sreekuttan2156239@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox