* [PATCH] sh: sh4: Fix reference count leak in sq_dev_add
@ 2020-07-25 0:17 ` Yi Wang
0 siblings, 0 replies; 6+ messages in thread
From: Yi Wang @ 2020-07-25 0:17 UTC (permalink / raw)
To: ysato
Cc: dalias, akpm, peterz, linux-sh, linux-kernel, xue.zhihong,
wang.yi59, wang.liang82, Liao Pingfang
From: Liao Pingfang <liao.pingfang@zte.com.cn>
kobject_init_and_add() takes reference even when it fails. If this
function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.
Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
arch/sh/kernel/cpu/sh4/sq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index d432164..3fbd6fd 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -350,6 +350,8 @@ static int sq_dev_add(struct device *dev, struct subsys_interface *sif)
"%s", "sq");
if (!error)
kobject_uevent(kobj, KOBJ_ADD);
+ else
+ kobject_put(kobj);
return error;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] sh: sh4: Fix reference count leak in sq_dev_add
@ 2020-07-25 0:17 ` Yi Wang
0 siblings, 0 replies; 6+ messages in thread
From: Yi Wang @ 2020-07-25 0:17 UTC (permalink / raw)
To: ysato
Cc: dalias, akpm, peterz, linux-sh, linux-kernel, xue.zhihong,
wang.yi59, wang.liang82, Liao Pingfang
From: Liao Pingfang <liao.pingfang@zte.com.cn>
kobject_init_and_add() takes reference even when it fails. If this
function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.
Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
arch/sh/kernel/cpu/sh4/sq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index d432164..3fbd6fd 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -350,6 +350,8 @@ static int sq_dev_add(struct device *dev, struct subsys_interface *sif)
"%s", "sq");
if (!error)
kobject_uevent(kobj, KOBJ_ADD);
+ else
+ kobject_put(kobj);
return error;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] sh: sh4: Fix reference count leak in sq_dev_add
@ 2020-07-25 11:27 ` Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-25 11:27 UTC (permalink / raw)
To: Yi Wang, Liao Pingfang, linux-sh
Cc: kernel-janitors, linux-kernel, Andrew Morton, Peter Zijlstra,
Rich Felker, Wang Liang, Xue Zhihong, Yoshinori Sato
> kobject_init_and_add() takes reference even when it fails. If this
> function returns an error, kobject_put() must be called to properly
> clean up the memory associated with the object.
* An imperative wording can be preferred for the change description,
can't it?
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh: sh4: Fix reference count leak in sq_dev_add
@ 2020-07-25 11:27 ` Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-25 11:27 UTC (permalink / raw)
To: Yi Wang, Liao Pingfang, linux-sh
Cc: kernel-janitors, linux-kernel, Andrew Morton, Peter Zijlstra,
Rich Felker, Wang Liang, Xue Zhihong, Yoshinori Sato
> kobject_init_and_add() takes reference even when it fails. If this
> function returns an error, kobject_put() must be called to properly
> clean up the memory associated with the object.
* An imperative wording can be preferred for the change description,
can't it?
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh: sh4: Fix reference count leak in sq_dev_add
@ 2020-07-25 11:27 ` Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-25 11:27 UTC (permalink / raw)
To: Yi Wang, Liao Pingfang, linux-sh
Cc: kernel-janitors, linux-kernel, Andrew Morton, Peter Zijlstra,
Rich Felker, Wang Liang, Xue Zhihong, Yoshinori Sato
> kobject_init_and_add() takes reference even when it fails. If this
> function returns an error, kobject_put() must be called to properly
> clean up the memory associated with the object.
* An imperative wording can be preferred for the change description,
can't it?
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sh: sh4: Fix reference count leak in sq_dev_add
@ 2020-07-25 11:27 ` Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-07-25 11:27 UTC (permalink / raw)
To: Yi Wang, Liao Pingfang, linux-sh
Cc: kernel-janitors, linux-kernel, Andrew Morton, Peter Zijlstra,
Rich Felker, Wang Liang, Xue Zhihong, Yoshinori Sato
> kobject_init_and_add() takes reference even when it fails. If this
> function returns an error, kobject_put() must be called to properly
> clean up the memory associated with the object.
* An imperative wording can be preferred for the change description,
can't it?
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-25 11:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25 0:17 [PATCH] sh: sh4: Fix reference count leak in sq_dev_add Yi Wang
2020-07-25 0:17 ` Yi Wang
2020-07-25 11:27 ` Markus Elfring
2020-07-25 11:27 ` Markus Elfring
2020-07-25 11:27 ` Markus Elfring
2020-07-25 11:27 ` Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.