The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Hongling Zeng <zenghongling@kylinos.cn>
Cc: dpenkler@gmail.com, dominik.karol.piatkowski@protonmail.com,
	adam.quandour@gmail.com, kees@kernel.org,
	linux-kernel@vger.kernel.org, zhongling0719@126.com
Subject: Re: [PATCH] gpib: cb7210: Fix region leak when request_irq fails
Date: Fri, 15 May 2026 10:07:20 +0200	[thread overview]
Message-ID: <2026051512-barracuda-delirious-37c7@gregkh> (raw)
In-Reply-To: <20260515073952.54359-1-zenghongling@kylinos.cn>

On Fri, May 15, 2026 at 03:39:52PM +0800, Hongling Zeng wrote:
> When request_irq() fails, the region allocated by request_region()
> is not released. Fix this by adding an error handling path with
> proper goto labels to release the region.
> 
> Fixes: 82e3508046f9b ("gpib: cb7210: add isa support module")
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
>  drivers/gpib/cb7210/cb7210.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpib/cb7210/cb7210.c b/drivers/gpib/cb7210/cb7210.c
> index 6dd8637c5964..7b0af517cf14 100644
> --- a/drivers/gpib/cb7210/cb7210.c
> +++ b/drivers/gpib/cb7210/cb7210.c
> @@ -1049,7 +1049,8 @@ static int cb_isa_attach(struct gpib_board *board, const struct gpib_board_confi
>  	if (!request_region(config->ibbase, cb7210_iosize, DRV_NAME)) {
>  		dev_err(board->gpib_dev, "ioports starting at 0x%x are already in use\n",
>  			config->ibbase);
> -		return -EBUSY;
> +		retval = -EBUSY;
> +		goto err_release_region;
>  	}
>  	nec_priv->iobase = config->ibbase;
>  	cb_priv->fifo_iobase = nec7210_iobase(cb_priv);
> @@ -1062,11 +1063,16 @@ static int cb_isa_attach(struct gpib_board *board, const struct gpib_board_confi
>  	// install interrupt handler
>  	if (request_irq(config->ibirq, cb7210_interrupt, isr_flags, DRV_NAME, board)) {
>  		dev_err(board->gpib_dev, "failed to obtain IRQ %d\n", config->ibirq);
> -		return -EBUSY;
> +		ret = -EBUSY;
> +		goto err_release_region;
>  	}
>  	cb_priv->irq = config->ibirq;
>  
>  	return cb7210_init(cb_priv, board);
> +
> +err_release_region:
> +	release_region(nec7210_iobase(cb_priv), cb7210_iosize);
> +	return retval;
>  }
>  
>  static void cb_isa_detach(struct gpib_board *board)
> -- 
> 2.25.1
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

  reply	other threads:[~2026-05-15  8:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  7:39 [PATCH] gpib: cb7210: Fix region leak when request_irq fails Hongling Zeng
2026-05-15  8:07 ` Greg KH [this message]
2026-05-15 21:16 ` kernel test robot
2026-05-15 22:23 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-15  8:35 Hongling Zeng
2026-05-15  8:49 ` Greg KH
2026-05-03  9:30 Hongling Zeng

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=2026051512-barracuda-delirious-37c7@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=adam.quandour@gmail.com \
    --cc=dominik.karol.piatkowski@protonmail.com \
    --cc=dpenkler@gmail.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zenghongling@kylinos.cn \
    --cc=zhongling0719@126.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