linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one()
@ 2022-03-19  7:01 Christophe JAILLET
  2022-03-21  9:00 ` Geert Uytterhoeven
  2022-03-30  4:05 ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-03-19  7:01 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen, Geert Uytterhoeven,
	James Bottomley
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-scsi

The error handling path of the probe releases a resource that is not freed
in the remove function.

In some cases, a ioremap() must be undone.

Add the missing iounmap() call in the remove function.

Fixes: 45804fbb00ee ("[SCSI] 53c700: Amiga Zorro NCR53c710 SCSI")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/scsi/zorro7xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index 27b9e2baab1a..7acf9193a9e8 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -159,6 +159,8 @@ static void zorro7xx_remove_one(struct zorro_dev *z)
 	scsi_remove_host(host);
 
 	NCR_700_release(host);
+	if (host->base > 0x01000000)
+		iounmap(hostdata->base);
 	kfree(hostdata);
 	free_irq(host->irq, host);
 	zorro_release_device(z);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one()
  2022-03-19  7:01 [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one() Christophe JAILLET
@ 2022-03-21  9:00 ` Geert Uytterhoeven
  2022-03-21 17:57   ` Christophe JAILLET
  2022-03-30  4:05 ` Martin K. Petersen
  1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2022-03-21  9:00 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: James E.J. Bottomley, Martin K. Petersen, James Bottomley,
	Linux Kernel Mailing List, kernel-janitors, scsi

Hi Christophe,

On Sat, Mar 19, 2022 at 8:01 AM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> The error handling path of the probe releases a resource that is not freed
> in the remove function.
>
> In some cases, a ioremap() must be undone.
>
> Add the missing iounmap() call in the remove function.
>
> Fixes: 45804fbb00ee ("[SCSI] 53c700: Amiga Zorro NCR53c710 SCSI")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Thanks for your patch!

The online-summary should be
"scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one()".

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one()
  2022-03-21  9:00 ` Geert Uytterhoeven
@ 2022-03-21 17:57   ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-03-21 17:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: James E.J. Bottomley, Martin K. Petersen, James Bottomley,
	Linux Kernel Mailing List, kernel-janitors, scsi

Le 21/03/2022 à 10:00, Geert Uytterhoeven a écrit :
> Hi Christophe,
> 
> On Sat, Mar 19, 2022 at 8:01 AM Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
>> The error handling path of the probe releases a resource that is not freed
>> in the remove function.
>>
>> In some cases, a ioremap() must be undone.
>>
>> Add the missing iounmap() call in the remove function.
>>
>> Fixes: 45804fbb00ee ("[SCSI] 53c700: Amiga Zorro NCR53c710 SCSI")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> Thanks for your patch!
> 
> The online-summary should be
> "scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one()".

Hi,
should I send a V2 or can this be fixed when/if applied?

CJ

> 
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Gr{oetje,eeting}s,
> 
>                          Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one()
  2022-03-19  7:01 [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one() Christophe JAILLET
  2022-03-21  9:00 ` Geert Uytterhoeven
@ 2022-03-30  4:05 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2022-03-30  4:05 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: James E.J. Bottomley, Martin K. Petersen, Geert Uytterhoeven,
	James Bottomley, linux-kernel, kernel-janitors, linux-scsi


Christophe,

> The error handling path of the probe releases a resource that is not freed
> in the remove function.

Applied to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-30  4:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19  7:01 [PATCH] zorro: Fix a resource leak in zorro7xx_remove_one() Christophe JAILLET
2022-03-21  9:00 ` Geert Uytterhoeven
2022-03-21 17:57   ` Christophe JAILLET
2022-03-30  4:05 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).