mISDN: fix misuse of put_device() in mISDN_register_device()

Message ID 20221110113823.167822-1-bobo.shaobowang@huawei.com
State New
Headers
Series mISDN: fix misuse of put_device() in mISDN_register_device() |

Commit Message

Wangshaobo (bobo) Nov. 10, 2022, 11:38 a.m. UTC
  We should not release reference by put_device() before calling device_initialize().

Fixes: e7d1d4d9ac0d ("mISDN: fix possible memory leak in mISDN_register_device()")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
 drivers/isdn/mISDN/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 14, 2022, 10:50 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 10 Nov 2022 19:38:23 +0800 you wrote:
> We should not release reference by put_device() before calling device_initialize().
> 
> Fixes: e7d1d4d9ac0d ("mISDN: fix possible memory leak in mISDN_register_device()")
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
> ---
>  drivers/isdn/mISDN/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - mISDN: fix misuse of put_device() in mISDN_register_device()
    https://git.kernel.org/netdev/net/c/2d25107e111a

You are awesome, thank you!
  

Patch

diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
index 7ea0100f218a..90ee56d07a6e 100644
--- a/drivers/isdn/mISDN/core.c
+++ b/drivers/isdn/mISDN/core.c
@@ -222,7 +222,7 @@  mISDN_register_device(struct mISDNdevice *dev,
 
 	err = get_free_devid();
 	if (err < 0)
-		goto error1;
+		return err;
 	dev->id = err;
 
 	device_initialize(&dev->dev);