All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stm class: Add a missing call to put_device
@ 2016-11-19 18:22 ` Quentin Lambert
  0 siblings, 0 replies; 6+ messages in thread
From: Quentin Lambert @ 2016-11-19 18:22 UTC (permalink / raw)
  To: Alexander Shishkin, linux-kernel, kernel-janitors; +Cc: Quentin Lambert

Most error branches following the call to class_find_device contain
a call to put_device. This patch add calls to put_device where
they are missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/hwtracing/stm/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
 		return -ENODEV;
 
 	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
-	if (!stmf)
+	if (!stmf) {
+		put_device(dev);
 		return -ENOMEM;
+	}
 
 	stm_output_init(&stmf->output);
 	stmf->stm = to_stm_device(dev);

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

* [PATCH] stm class: Add a missing call to put_device
@ 2016-11-19 18:22 ` Quentin Lambert
  0 siblings, 0 replies; 6+ messages in thread
From: Quentin Lambert @ 2016-11-19 18:22 UTC (permalink / raw)
  To: Alexander Shishkin, linux-kernel, kernel-janitors; +Cc: Quentin Lambert

Most error branches following the call to class_find_device contain
a call to put_device. This patch add calls to put_device where
they are missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/hwtracing/stm/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
 		return -ENODEV;
 
 	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
-	if (!stmf)
+	if (!stmf) {
+		put_device(dev);
 		return -ENOMEM;
+	}
 
 	stm_output_init(&stmf->output);
 	stmf->stm = to_stm_device(dev);

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

* Re: [PATCH] stm class: Add a missing call to put_device
  2016-11-19 18:22 ` Quentin Lambert
@ 2016-11-21  7:32   ` Alexander Shishkin
  -1 siblings, 0 replies; 6+ messages in thread
From: Alexander Shishkin @ 2016-11-21  7:32 UTC (permalink / raw)
  To: Quentin Lambert, linux-kernel, kernel-janitors; +Cc: Quentin Lambert

Quentin Lambert <lambert.quentin@gmail.com> writes:

> Most error branches following the call to class_find_device contain
> a call to put_device. This patch add calls to put_device where
> they are missing.
>
> This issue was found with Hector.
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>
> ---
>  drivers/hwtracing/stm/core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> --- a/drivers/hwtracing/stm/core.c
> +++ b/drivers/hwtracing/stm/core.c
> @@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
>  		return -ENODEV;
>  
>  	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
> -	if (!stmf)
> +	if (!stmf) {
> +		put_device(dev);
>  		return -ENOMEM;
> +	}

There is a goto label at the bottom of this function which is supposed
 to deal with this. See the fix that we already have [1] for this issue.

[1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id=a0ebf519b8a2666438d999c62995618c710573e5

Regards,
--
alex

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

* Re: [PATCH] stm class: Add a missing call to put_device
@ 2016-11-21  7:32   ` Alexander Shishkin
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Shishkin @ 2016-11-21  7:32 UTC (permalink / raw)
  To: Quentin Lambert, linux-kernel, kernel-janitors

Quentin Lambert <lambert.quentin@gmail.com> writes:

> Most error branches following the call to class_find_device contain
> a call to put_device. This patch add calls to put_device where
> they are missing.
>
> This issue was found with Hector.
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>
> ---
>  drivers/hwtracing/stm/core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> --- a/drivers/hwtracing/stm/core.c
> +++ b/drivers/hwtracing/stm/core.c
> @@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
>  		return -ENODEV;
>  
>  	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
> -	if (!stmf)
> +	if (!stmf) {
> +		put_device(dev);
>  		return -ENOMEM;
> +	}

There is a goto label at the bottom of this function which is supposed
 to deal with this. See the fix that we already have [1] for this issue.

[1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id ebf519b8a2666438d999c62995618c710573e5

Regards,
--
alex
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] stm class: Add a missing call to put_device
  2016-11-21  7:32   ` Alexander Shishkin
@ 2016-11-21  7:58     ` Quentin Lambert
  -1 siblings, 0 replies; 6+ messages in thread
From: Quentin Lambert @ 2016-11-21  7:58 UTC (permalink / raw)
  To: Alexander Shishkin, linux-kernel, kernel-janitors



On 11/21/2016 08:32 AM, Alexander Shishkin wrote:
> Quentin Lambert <lambert.quentin@gmail.com> writes:
>
>> Most error branches following the call to class_find_device contain
>> a call to put_device. This patch add calls to put_device where
>> they are missing.
>>
>> This issue was found with Hector.
>>
>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>>
>> ---
>>   drivers/hwtracing/stm/core.c |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> --- a/drivers/hwtracing/stm/core.c
>> +++ b/drivers/hwtracing/stm/core.c
>> @@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
>>   		return -ENODEV;
>>   
>>   	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
>> -	if (!stmf)
>> +	if (!stmf) {
>> +		put_device(dev);
>>   		return -ENOMEM;
>> +	}
> There is a goto label at the bottom of this function which is supposed
>   to deal with this. See the fix that we already have [1] for this issue.
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id=a0ebf519b8a2666438d999c62995618c710573e5
>
> Regards,
> --
> alex
Your fix is better, you are right, I did not use the goto label because 
of the free.

Thanks for your feedback though.

Regards,
Quentin

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

* Re: [PATCH] stm class: Add a missing call to put_device
@ 2016-11-21  7:58     ` Quentin Lambert
  0 siblings, 0 replies; 6+ messages in thread
From: Quentin Lambert @ 2016-11-21  7:58 UTC (permalink / raw)
  To: Alexander Shishkin, linux-kernel, kernel-janitors



On 11/21/2016 08:32 AM, Alexander Shishkin wrote:
> Quentin Lambert <lambert.quentin@gmail.com> writes:
>
>> Most error branches following the call to class_find_device contain
>> a call to put_device. This patch add calls to put_device where
>> they are missing.
>>
>> This issue was found with Hector.
>>
>> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
>>
>> ---
>>   drivers/hwtracing/stm/core.c |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> --- a/drivers/hwtracing/stm/core.c
>> +++ b/drivers/hwtracing/stm/core.c
>> @@ -368,8 +368,10 @@ static int stm_char_open(struct inode *i
>>   		return -ENODEV;
>>   
>>   	stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
>> -	if (!stmf)
>> +	if (!stmf) {
>> +		put_device(dev);
>>   		return -ENOMEM;
>> +	}
> There is a goto label at the bottom of this function which is supposed
>   to deal with this. See the fix that we already have [1] for this issue.
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/ash/stm.git/commit/?h=stm-for-greg-20161118&id ebf519b8a2666438d999c62995618c710573e5
>
> Regards,
> --
> alex
Your fix is better, you are right, I did not use the goto label because 
of the free.

Thanks for your feedback though.

Regards,
Quentin
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-11-21  8:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 18:22 [PATCH] stm class: Add a missing call to put_device Quentin Lambert
2016-11-19 18:22 ` Quentin Lambert
2016-11-21  7:32 ` Alexander Shishkin
2016-11-21  7:32   ` Alexander Shishkin
2016-11-21  7:58   ` Quentin Lambert
2016-11-21  7:58     ` Quentin Lambert

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.