lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <s5ho8cc7m1m.wl-tiwai@suse.de>
Date:   Fri, 11 Jun 2021 12:06:29 +0200
From:   Takashi Iwai <tiwai@...e.de>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Ulf Hansson <ulf.hansson@...aro.org>, linux-mmc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: sdhci: Clear unused bounce buffer at DMA mmap error path

On Fri, 11 Jun 2021 11:56:16 +0200,
Adrian Hunter wrote:
> 
> On 11/06/21 12:03 pm, Takashi Iwai wrote:
> > When DMA-mapping of the bounce buffer fails, the driver tries to fall
> > back, but it leaves the allocated host->bounce_buffer although its
> > size is zero.  Later on, the driver checks the use of bounce buffer
> > with host->bounce_buffer pointer, and it tries to use the buffer
> > incorrectly, resulting in Oops.
> > 
> > This patch clears the release the unused buffer and clears the
> > bounce_buffer pointer for addressing the problem.
> > 
> > Signed-off-by: Takashi Iwai <tiwai@...e.de>
> 
> One minor comment below, otherwise:
> 
> Acked-by: Adrian Hunter <adrian.hunter@...el.com>
> 
> > ---
> >  drivers/mmc/host/sdhci.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index bf238ade1602..5f467b98ca88 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -4072,9 +4072,13 @@ static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)
> >  					   bounce_size,
> >  					   DMA_BIDIRECTIONAL);
> >  	ret = dma_mapping_error(mmc_dev(mmc), host->bounce_addr);
> > -	if (ret)
> > +	if (ret) {
> > +		devm_kfree(mmc->parent, host->bounce_buffer);
> 
> Everywhere else in this function mmc_dev(mmc) is used, so maybe
> use it here too instead of mmc->parent.

Doh, right, I wrote a patch based on the older kernel and refreshed
afterwards, but I forgot correcting this place.  Will resubmit the
fixed version.


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ