All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] baum: Fix crash when Braille output is not available
@ 2021-03-10 16:08 Samuel Thibault
  2021-03-10 17:18 ` Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Samuel Thibault @ 2021-03-10 16:08 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: Samuel Thibault

When Braille output is not available, the backend properly reports being
unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
imply timer_del()") made the timer_free() call now refuse any NULL
parameter. char_braille_finalize thus now has to be more careful with
calling it on baum->cellCount_timer.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 chardev/baum.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/chardev/baum.c b/chardev/baum.c
index 5deca778bc..aca5bf12fb 100644
--- a/chardev/baum.c
+++ b/chardev/baum.c
@@ -631,7 +631,9 @@ static void char_braille_finalize(Object *obj)
 {
     BaumChardev *baum = BAUM_CHARDEV(obj);
 
-    timer_free(baum->cellCount_timer);
+    if (baum->cellCount_timer) {
+        timer_free(baum->cellCount_timer);
+    }
     if (baum->brlapi) {
         brlapi__closeConnection(baum->brlapi);
         g_free(baum->brlapi);
-- 
2.30.1



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

* Re: [PATCH] baum: Fix crash when Braille output is not available
  2021-03-10 16:08 [PATCH] baum: Fix crash when Braille output is not available Samuel Thibault
@ 2021-03-10 17:18 ` Peter Maydell
  2021-03-10 17:19   ` Samuel Thibault
  2021-03-10 17:23 ` Thomas Huth
  2021-03-10 17:23 ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2021-03-10 17:18 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: QEMU Developers

On Wed, 10 Mar 2021 at 16:08, Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> When Braille output is not available, the backend properly reports being
> unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
> imply timer_del()") made the timer_free() call now refuse any NULL
> parameter. char_braille_finalize thus now has to be more careful with
> calling it on baum->cellCount_timer.

It wasn't the intention of that commit to make freeing a NULL
timer invalid; I think Paolo's patch restoring the ability to
timer_free(NULL) is probably the right thing here:
https://patchew.org/QEMU/20210310154526.463850-1-pbonzini@redhat.com/

thanks
-- PMM


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

* Re: [PATCH] baum: Fix crash when Braille output is not available
  2021-03-10 17:18 ` Peter Maydell
@ 2021-03-10 17:19   ` Samuel Thibault
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Thibault @ 2021-03-10 17:19 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

Peter Maydell, le mer. 10 mars 2021 17:18:11 +0000, a ecrit:
> On Wed, 10 Mar 2021 at 16:08, Samuel Thibault
> <samuel.thibault@ens-lyon.org> wrote:
> >
> > When Braille output is not available, the backend properly reports being
> > unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
> > imply timer_del()") made the timer_free() call now refuse any NULL
> > parameter. char_braille_finalize thus now has to be more careful with
> > calling it on baum->cellCount_timer.
> 
> It wasn't the intention of that commit to make freeing a NULL
> timer invalid;

Ok!

Samuel


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

* Re: [PATCH] baum: Fix crash when Braille output is not available
  2021-03-10 16:08 [PATCH] baum: Fix crash when Braille output is not available Samuel Thibault
  2021-03-10 17:18 ` Peter Maydell
@ 2021-03-10 17:23 ` Thomas Huth
  2021-04-30 17:01   ` Laurent Vivier
  2021-03-10 17:23 ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Thomas Huth @ 2021-03-10 17:23 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel, peter.maydell
  Cc: QEMU Trivial, Paolo Bonzini, Gerd Hoffmann, Markus Armbruster,
	Marc-André Lureau

On 10/03/2021 17.08, Samuel Thibault wrote:
> When Braille output is not available, the backend properly reports being
> unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
> imply timer_del()") made the timer_free() call now refuse any NULL
> parameter. char_braille_finalize thus now has to be more careful with
> calling it on baum->cellCount_timer.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>   chardev/baum.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/chardev/baum.c b/chardev/baum.c
> index 5deca778bc..aca5bf12fb 100644
> --- a/chardev/baum.c
> +++ b/chardev/baum.c
> @@ -631,7 +631,9 @@ static void char_braille_finalize(Object *obj)
>   {
>       BaumChardev *baum = BAUM_CHARDEV(obj);
>   
> -    timer_free(baum->cellCount_timer);
> +    if (baum->cellCount_timer) {
> +        timer_free(baum->cellCount_timer);
> +    }
>       if (baum->brlapi) {
>           brlapi__closeConnection(baum->brlapi);
>           g_free(baum->brlapi);

I just tried to debug this problem, too, and came to the same conclusion.

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH] baum: Fix crash when Braille output is not available
  2021-03-10 16:08 [PATCH] baum: Fix crash when Braille output is not available Samuel Thibault
  2021-03-10 17:18 ` Peter Maydell
  2021-03-10 17:23 ` Thomas Huth
@ 2021-03-10 17:23 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-10 17:23 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel, peter.maydell

Hi Samuel,

On 3/10/21 5:08 PM, Samuel Thibault wrote:
> When Braille output is not available, the backend properly reports being
> unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
> imply timer_del()") made the timer_free() call now refuse any NULL
> parameter. char_braille_finalize thus now has to be more careful with
> calling it on baum->cellCount_timer.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>  chardev/baum.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/chardev/baum.c b/chardev/baum.c
> index 5deca778bc..aca5bf12fb 100644
> --- a/chardev/baum.c
> +++ b/chardev/baum.c
> @@ -631,7 +631,9 @@ static void char_braille_finalize(Object *obj)
>  {
>      BaumChardev *baum = BAUM_CHARDEV(obj);
>  
> -    timer_free(baum->cellCount_timer);
> +    if (baum->cellCount_timer) {
> +        timer_free(baum->cellCount_timer);
> +    }

Paolo's approach is more generic:
https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg03457.html



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

* Re: [PATCH] baum: Fix crash when Braille output is not available
  2021-03-10 17:23 ` Thomas Huth
@ 2021-04-30 17:01   ` Laurent Vivier
  2021-04-30 17:07     ` Laurent Vivier
  0 siblings, 1 reply; 7+ messages in thread
From: Laurent Vivier @ 2021-04-30 17:01 UTC (permalink / raw)
  To: Thomas Huth, Samuel Thibault, qemu-devel, peter.maydell
  Cc: QEMU Trivial, Paolo Bonzini, Gerd Hoffmann,
	Marc-André Lureau, Markus Armbruster

Le 10/03/2021 à 18:23, Thomas Huth a écrit :
> On 10/03/2021 17.08, Samuel Thibault wrote:
>> When Braille output is not available, the backend properly reports being
>> unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
>> imply timer_del()") made the timer_free() call now refuse any NULL
>> parameter. char_braille_finalize thus now has to be more careful with
>> calling it on baum->cellCount_timer.
>>
>> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>> ---
>>   chardev/baum.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/chardev/baum.c b/chardev/baum.c
>> index 5deca778bc..aca5bf12fb 100644
>> --- a/chardev/baum.c
>> +++ b/chardev/baum.c
>> @@ -631,7 +631,9 @@ static void char_braille_finalize(Object *obj)
>>   {
>>       BaumChardev *baum = BAUM_CHARDEV(obj);
>>   -    timer_free(baum->cellCount_timer);
>> +    if (baum->cellCount_timer) {
>> +        timer_free(baum->cellCount_timer);
>> +    }
>>       if (baum->brlapi) {
>>           brlapi__closeConnection(baum->brlapi);
>>           g_free(baum->brlapi);
> 
> I just tried to debug this problem, too, and came to the same conclusion.
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


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

* Re: [PATCH] baum: Fix crash when Braille output is not available
  2021-04-30 17:01   ` Laurent Vivier
@ 2021-04-30 17:07     ` Laurent Vivier
  0 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2021-04-30 17:07 UTC (permalink / raw)
  To: Thomas Huth, Samuel Thibault, qemu-devel, peter.maydell
  Cc: QEMU Trivial, Paolo Bonzini, Gerd Hoffmann,
	Marc-André Lureau, Markus Armbruster

Le 30/04/2021 à 19:01, Laurent Vivier a écrit :
> Le 10/03/2021 à 18:23, Thomas Huth a écrit :
>> On 10/03/2021 17.08, Samuel Thibault wrote:
>>> When Braille output is not available, the backend properly reports being
>>> unable to be created, but 5f8e93c3e262 ("util/qemu-timer: Make timer_free()
>>> imply timer_del()") made the timer_free() call now refuse any NULL
>>> parameter. char_braille_finalize thus now has to be more careful with
>>> calling it on baum->cellCount_timer.
>>>
>>> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>>> ---
>>>   chardev/baum.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/chardev/baum.c b/chardev/baum.c
>>> index 5deca778bc..aca5bf12fb 100644
>>> --- a/chardev/baum.c
>>> +++ b/chardev/baum.c
>>> @@ -631,7 +631,9 @@ static void char_braille_finalize(Object *obj)
>>>   {
>>>       BaumChardev *baum = BAUM_CHARDEV(obj);
>>>   -    timer_free(baum->cellCount_timer);
>>> +    if (baum->cellCount_timer) {
>>> +        timer_free(baum->cellCount_timer);
>>> +    }
>>>       if (baum->brlapi) {
>>>           brlapi__closeConnection(baum->brlapi);
>>>           g_free(baum->brlapi);
>>
>> I just tried to debug this problem, too, and came to the same conclusion.
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>
>>
> 
> Applied to my trivial-patches branch.
> 

Unapplied from my branch because of:

https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg03457.html

[missed it because all the thread was not cc'ed to trivial]

Thanks,
Laurent


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

end of thread, other threads:[~2021-04-30 17:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 16:08 [PATCH] baum: Fix crash when Braille output is not available Samuel Thibault
2021-03-10 17:18 ` Peter Maydell
2021-03-10 17:19   ` Samuel Thibault
2021-03-10 17:23 ` Thomas Huth
2021-04-30 17:01   ` Laurent Vivier
2021-04-30 17:07     ` Laurent Vivier
2021-03-10 17:23 ` Philippe Mathieu-Daudé

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.