Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] rapidio: fix a resource leak when rio_add_device() fails
@ 2025-12-21 12:05 Haoxiang Li
  2025-12-21 12:20 ` Greg KH
  2025-12-22 23:13 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-12-21 12:05 UTC (permalink / raw)
  To: mporter, alex.bou9, akpm, dan.carpenter, linux
  Cc: linux-kernel, Haoxiang Li, stable

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;
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2025-12-22 23:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2025-12-22 23:13 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox