Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: mporter@kernel.crashing.org, alex.bou9@gmail.com,
	akpm@linux-foundation.org, dan.carpenter@linaro.org,
	linux@treblig.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] rapidio: fix a resource leak when rio_add_device() fails
Date: Sun, 21 Dec 2025 13:20:07 +0100	[thread overview]
Message-ID: <2025122135-shudder-corrosive-480a@gregkh> (raw)
In-Reply-To: <20251221120538.947670-1-lihaoxiang@isrc.iscas.ac.cn>

On Sun, Dec 21, 2025 at 08:05:38PM +0800, Haoxiang Li wrote:
> If rio_add_device() fails, call rio_free_net() to unregister
> the net device registered by rio_add_net().
> 
> Fixes: e8de370188d0 ("rapidio: add mport char device driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
>  drivers/rapidio/devices/rio_mport_cdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
> index 995cfeca972b..4a804b4ad6f7 100644
> --- a/drivers/rapidio/devices/rio_mport_cdev.c
> +++ b/drivers/rapidio/devices/rio_mport_cdev.c
> @@ -1789,6 +1789,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
>  	err = rio_add_device(rdev);
>  	if (err) {
>  		put_device(&rdev->dev);
> +		rio_free_net(net);
>  		return err;

Are you sure this is right?  You aren't checking that rio_add_net() was
actually called.  How was this tested?  How was this found?  What tool
was used to find it?

thanks,

greg k-h

  reply	other threads:[~2025-12-21 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-21 12:05 [PATCH] rapidio: fix a resource leak when rio_add_device() fails Haoxiang Li
2025-12-21 12:20 ` Greg KH [this message]
2025-12-22 23:13 ` kernel test robot

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=2025122135-shudder-corrosive-480a@gregkh \
    --to=greg@kroah.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.bou9@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=lihaoxiang@isrc.iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=mporter@kernel.crashing.org \
    --cc=stable@vger.kernel.org \
    /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