[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025122135-shudder-corrosive-480a@gregkh>
Date: Sun, 21 Dec 2025 13:20:07 +0100
From: Greg KH <greg@...ah.com>
To: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
Cc: mporter@...nel.crashing.org, alex.bou9@...il.com,
akpm@...ux-foundation.org, dan.carpenter@...aro.org,
linux@...blig.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] rapidio: fix a resource leak when rio_add_device() fails
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@...r.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@...c.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
Powered by blists - more mailing lists