[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221123113221.207751-1-shaozhengchao@huawei.com>
Date: Wed, 23 Nov 2022 19:32:21 +0800
From: Zhengchao Shao <shaozhengchao@...wei.com>
To: <linux-kernel@...r.kernel.org>, <morbidrsa@...il.com>
CC: <gregkh@...uxfoundation.org>, <weiyongjun1@...wei.com>,
<yuehaibing@...wei.com>, <shaozhengchao@...wei.com>
Subject: [PATCH] drivers: mcb: fix resource leak in mcb_probe()
When probe hook function failed in mcb_probe(), it doesn't put the device.
Compiled test only.
Fixes: 7bc364097a89 ("mcb: Acquire reference to device in probe")
Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
---
drivers/mcb/mcb-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c
index 338fc889b357..b8ad4f16b4ac 100644
--- a/drivers/mcb/mcb-core.c
+++ b/drivers/mcb/mcb-core.c
@@ -71,8 +71,10 @@ static int mcb_probe(struct device *dev)
get_device(dev);
ret = mdrv->probe(mdev, found_id);
- if (ret)
+ if (ret) {
module_put(carrier_mod);
+ put_device(dev);
+ }
return ret;
}
--
2.17.1
Powered by blists - more mailing lists