[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <yq1ms6js4m9.fsf@ca-mkp.ca.oracle.com>
Date: Wed, 24 Sep 2025 21:28:12 -0400
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Don Brace <don.brace@...rochip.com>,
"James E.J. Bottomley"
<James.Bottomley@...senPartnership.com>,
"Martin K. Petersen"
<martin.petersen@...cle.com>,
Mike Miller <mikem@...rdog.cce.hp.com>,
James Bottomley <James.Bottomley@...e.de>,
Andrew Morton
<akpm@...ux-foundation.org>,
Alex Chiang <achiang@...com>,
"Stephen M.
Cameron" <scameron@...rdog.cce.hp.com>,
stable@...r.kernel.org, storagedev@...rochip.com,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND] scsi: hpsa: Fix potential memory leak in
hpsa_big_passthru_ioctl()
Thorsten,
> Replace kmalloc() followed by copy_from_user() with memdup_user() to
> fix a memory leak that occurs when copy_from_user(buff[sg_used],,)
> fails and the 'cleanup1:' path does not free the memory for
> 'buff[sg_used]'. Using memdup_user() avoids this by freeing the memory
> internally.
>
> Since memdup_user() already allocates memory, use kzalloc() in the
> else branch instead of manually zeroing 'buff[sg_used]' using
> memset(0).
Applied to 6.18/scsi-staging, thanks!
--
Martin K. Petersen
Powered by blists - more mailing lists