qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] chardev/tcp: fix error message double free error
@ 2020-06-21 21:30 lichun
  2020-06-25  6:47 ` Markus Armbruster
  2020-07-01  7:06 ` Markus Armbruster
  0 siblings, 2 replies; 9+ messages in thread
From: lichun @ 2020-06-21 21:30 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: pbonzini, lichun, qemu-devel, 706701795

Signed-off-by: lichun <lichun@ruijie.com.cn>
---
 chardev/char-socket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index afebeec5c3..569d54c144 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
                           "Unable to connect character device %s: ",
                           chr->label);
         s->connect_err_reported = true;
+    } else {
+        error_free(err);
     }
     qemu_chr_socket_restart_timer(chr);
 }
@@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
     if (qio_task_propagate_error(task, &err)) {
         tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
         check_report_connect_error(chr, err);
-        error_free(err);
         goto cleanup;
     }
 
-- 
2.18.4



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

* Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-06-21 21:30 [PATCH v2] chardev/tcp: fix error message double free error lichun
@ 2020-06-25  6:47 ` Markus Armbruster
  2020-06-25  9:25   ` Marc-André Lureau
  2020-07-01  7:06 ` Markus Armbruster
  1 sibling, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2020-06-25  6:47 UTC (permalink / raw)
  To: lichun; +Cc: marcandre.lureau, 706701795, qemu-devel, pbonzini

lichun <lichun@ruijie.com.cn> writes:

> Signed-off-by: lichun <lichun@ruijie.com.cn>
> ---
>  chardev/char-socket.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index afebeec5c3..569d54c144 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>                            "Unable to connect character device %s: ",
>                            chr->label);
>          s->connect_err_reported = true;
> +    } else {
> +        error_free(err);
>      }
>      qemu_chr_socket_restart_timer(chr);
>  }
> @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>      if (qio_task_propagate_error(task, &err)) {
>          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>          check_report_connect_error(chr, err);
> -        error_free(err);
>          goto cleanup;
>      }

Since my "Error handling fixes & cleanups" series fixes similar errors.
I'm happy to merge this patch along with it.  Up to Marc-André.



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

* Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-06-25  6:47 ` Markus Armbruster
@ 2020-06-25  9:25   ` Marc-André Lureau
  2020-06-28  2:19     ` lichun
  0 siblings, 1 reply; 9+ messages in thread
From: Marc-André Lureau @ 2020-06-25  9:25 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Bonzini, Paolo, lichun, qemu-devel, 706701795

Hi

On Thu, Jun 25, 2020 at 10:47 AM Markus Armbruster <armbru@redhat.com> wrote:
>
> lichun <lichun@ruijie.com.cn> writes:
>
> > Signed-off-by: lichun <lichun@ruijie.com.cn>
> > ---
> >  chardev/char-socket.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> > index afebeec5c3..569d54c144 100644
> > --- a/chardev/char-socket.c
> > +++ b/chardev/char-socket.c
> > @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
> >                            "Unable to connect character device %s: ",
> >                            chr->label);
> >          s->connect_err_reported = true;
> > +    } else {
> > +        error_free(err);
> >      }
> >      qemu_chr_socket_restart_timer(chr);
> >  }
> > @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
> >      if (qio_task_propagate_error(task, &err)) {
> >          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
> >          check_report_connect_error(chr, err);
> > -        error_free(err);
> >          goto cleanup;
> >      }
>
> Since my "Error handling fixes & cleanups" series fixes similar errors.
> I'm happy to merge this patch along with it.  Up to Marc-André.

That would be great, thanks!



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

* Re: Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-06-25  9:25   ` Marc-André Lureau
@ 2020-06-28  2:19     ` lichun
  0 siblings, 0 replies; 9+ messages in thread
From: lichun @ 2020-06-28  2:19 UTC (permalink / raw)
  To: marcandre.lureau, armbru; +Cc: pbonzini, qemu-devel, 706701795

>Hi
>
>On Thu, Jun 25, 2020 at 10:47 AM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> lichun <lichun@ruijie.com.cn> writes:
>>
>> > Signed-off-by: lichun <lichun@ruijie.com.cn>
>> > ---
>> >  chardev/char-socket.c | 3 ++-
>> >  1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>> > index afebeec5c3..569d54c144 100644
>> > --- a/chardev/char-socket.c
>> > +++ b/chardev/char-socket.c
>> > @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>> >                            "Unable to connect character device %s: ",
>> >                            chr->label);
>> >          s->connect_err_reported = true;
>> > +    } else {
>> > +        error_free(err);
>> >      }
>> >      qemu_chr_socket_restart_timer(chr);
>> >  }
>> > @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>> >      if (qio_task_propagate_error(task, &err)) {
>> >          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>> >          check_report_connect_error(chr, err);
>> > -        error_free(err);
>> >          goto cleanup;
>> >      }
>>
>> Since my "Error handling fixes & cleanups" series fixes similar errors.
>> I'm happy to merge this patch along with it.  Up to Marc-André.
>
>That would be great, thanks! 
Thank you!
>

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

* Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-06-21 21:30 [PATCH v2] chardev/tcp: fix error message double free error lichun
  2020-06-25  6:47 ` Markus Armbruster
@ 2020-07-01  7:06 ` Markus Armbruster
  2020-07-01 13:09   ` Paolo Bonzini
  1 sibling, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2020-07-01  7:06 UTC (permalink / raw)
  To: lichun; +Cc: marcandre.lureau, 706701795, qemu-devel, pbonzini

lichun <lichun@ruijie.com.cn> writes:

> Signed-off-by: lichun <lichun@ruijie.com.cn>
> ---
>  chardev/char-socket.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index afebeec5c3..569d54c144 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>                            "Unable to connect character device %s: ",
>                            chr->label);
>          s->connect_err_reported = true;
> +    } else {
> +        error_free(err);
>      }
>      qemu_chr_socket_restart_timer(chr);
>  }
> @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>      if (qio_task_propagate_error(task, &err)) {
>          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>          check_report_connect_error(chr, err);
> -        error_free(err);
>          goto cleanup;
>      }

Reviewed-by: Markus Armbruster <armbru@redhat.com>

and queued, thanks!



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

* Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-07-01  7:06 ` Markus Armbruster
@ 2020-07-01 13:09   ` Paolo Bonzini
  2020-07-01 15:12     ` lichun
  2020-07-02  4:25     ` Markus Armbruster
  0 siblings, 2 replies; 9+ messages in thread
From: Paolo Bonzini @ 2020-07-01 13:09 UTC (permalink / raw)
  To: Markus Armbruster, lichun; +Cc: marcandre.lureau, qemu-devel, 706701795

On 01/07/20 09:06, Markus Armbruster wrote:
> lichun <lichun@ruijie.com.cn> writes:
> 
>> Signed-off-by: lichun <lichun@ruijie.com.cn>
>> ---
>>  chardev/char-socket.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>> index afebeec5c3..569d54c144 100644
>> --- a/chardev/char-socket.c
>> +++ b/chardev/char-socket.c
>> @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>>                            "Unable to connect character device %s: ",
>>                            chr->label);
>>          s->connect_err_reported = true;
>> +    } else {
>> +        error_free(err);
>>      }
>>      qemu_chr_socket_restart_timer(chr);
>>  }
>> @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>>      if (qio_task_propagate_error(task, &err)) {
>>          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>          check_report_connect_error(chr, err);
>> -        error_free(err);
>>          goto cleanup;
>>      }
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> 
> and queued, thanks!
> 

Can you please add a note to the commit message?

    Errors are already freed by error_report_err, so we only need to call
    error_free when that function is not called.
    
and Cc qemu-stable?  Or I can queue it too since it's chardev stuff.



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

* Re: Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-07-01 13:09   ` Paolo Bonzini
@ 2020-07-01 15:12     ` lichun
  2020-07-01 15:14       ` Paolo Bonzini
  2020-07-02  4:25     ` Markus Armbruster
  1 sibling, 1 reply; 9+ messages in thread
From: lichun @ 2020-07-01 15:12 UTC (permalink / raw)
  To: pbonzini, armbru; +Cc: marcandre.lureau, qemu-devel, 706701795

>On 01/07/20 09:06, Markus Armbruster wrote:
>> lichun <lichun@ruijie.com.cn> writes:
>>
>>> Signed-off-by: lichun <lichun@ruijie.com.cn>
>>> ---
>>>  chardev/char-socket.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>>> index afebeec5c3..569d54c144 100644
>>> --- a/chardev/char-socket.c
>>> +++ b/chardev/char-socket.c
>>> @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>>>                            "Unable to connect character device %s: ",
>>>                            chr->label);
>>>          s->connect_err_reported = true;
>>> +    } else {
>>> +        error_free(err);
>>>      }
>>>      qemu_chr_socket_restart_timer(chr);
>>>  }
>>> @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>>>      if (qio_task_propagate_error(task, &err)) {
>>>          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>>          check_report_connect_error(chr, err);
>>> -        error_free(err);
>>>          goto cleanup;
>>>      }
>>
>> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>>
>> and queued, thanks!
>>
>
>Can you please add a note to the commit message?
>
>    Errors are already freed by error_report_err, so we only need to call
>    error_free when that function is not called.
>  
>and Cc qemu-stable?  Or I can queue it too since it's chardev stuff. 
Ok,  I'll post v3.
>

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

* Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-07-01 15:12     ` lichun
@ 2020-07-01 15:14       ` Paolo Bonzini
  0 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2020-07-01 15:14 UTC (permalink / raw)
  To: lichun, armbru; +Cc: marcandre.lureau, qemu-devel, 706701795

On 01/07/20 17:12, lichun@ruijie.com.cn wrote:
>> On 01/07/20 09:06, Markus Armbruster wrote:
>>> lichun <lichun@ruijie.com.cn> writes:
>>>
>>>> Signed-off-by: lichun <lichun@ruijie.com.cn>
>>>> ---
>>>>   chardev/char-socket.c | 3 ++-
>>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>>>> index afebeec5c3..569d54c144 100644
>>>> --- a/chardev/char-socket.c
>>>> +++ b/chardev/char-socket.c
>>>> @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>>>>                             "Unable to connect character device %s: ",
>>>>                             chr->label);
>>>>           s->connect_err_reported = true;
>>>> +    } else {
>>>> +        error_free(err);
>>>>       }
>>>>       qemu_chr_socket_restart_timer(chr);
>>>>   }
>>>> @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>>>>       if (qio_task_propagate_error(task, &err)) {
>>>>           tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>>>           check_report_connect_error(chr, err);
>>>> -        error_free(err);
>>>>           goto cleanup;
>>>>       }
>>>
>>> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>>>
>>> and queued, thanks!
>>>
>>
>> Can you please add a note to the commit message?
>>
>>     Errors are already freed by error_report_err, so we only need to call
>>     error_free when that function is not called.
>>   
>> and Cc qemu-stable?  Or I can queue it too since it's chardev stuff. 
> Ok,  I'll post v3.

No need for that, thanks!  (My message was for Markus).

Paolo



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

* Re: [PATCH v2] chardev/tcp: fix error message double free error
  2020-07-01 13:09   ` Paolo Bonzini
  2020-07-01 15:12     ` lichun
@ 2020-07-02  4:25     ` Markus Armbruster
  1 sibling, 0 replies; 9+ messages in thread
From: Markus Armbruster @ 2020-07-02  4:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: marcandre.lureau, lichun, qemu-devel, 706701795

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 01/07/20 09:06, Markus Armbruster wrote:
>> lichun <lichun@ruijie.com.cn> writes:
>> 
>>> Signed-off-by: lichun <lichun@ruijie.com.cn>
>>> ---
>>>  chardev/char-socket.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
>>> index afebeec5c3..569d54c144 100644
>>> --- a/chardev/char-socket.c
>>> +++ b/chardev/char-socket.c
>>> @@ -142,6 +142,8 @@ static void check_report_connect_error(Chardev *chr,
>>>                            "Unable to connect character device %s: ",
>>>                            chr->label);
>>>          s->connect_err_reported = true;
>>> +    } else {
>>> +        error_free(err);
>>>      }
>>>      qemu_chr_socket_restart_timer(chr);
>>>  }
>>> @@ -1086,7 +1088,6 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
>>>      if (qio_task_propagate_error(task, &err)) {
>>>          tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>>          check_report_connect_error(chr, err);
>>> -        error_free(err);
>>>          goto cleanup;
>>>      }
>> 
>> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>> 
>> and queued, thanks!
>> 
>
> Can you please add a note to the commit message?
>
>     Errors are already freed by error_report_err, so we only need to call
>     error_free when that function is not called.
>     
> and Cc qemu-stable?  Or I can queue it too since it's chardev stuff.

Done in my tree, expect PR later today.



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

end of thread, other threads:[~2020-07-02  4:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-21 21:30 [PATCH v2] chardev/tcp: fix error message double free error lichun
2020-06-25  6:47 ` Markus Armbruster
2020-06-25  9:25   ` Marc-André Lureau
2020-06-28  2:19     ` lichun
2020-07-01  7:06 ` Markus Armbruster
2020-07-01 13:09   ` Paolo Bonzini
2020-07-01 15:12     ` lichun
2020-07-01 15:14       ` Paolo Bonzini
2020-07-02  4:25     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).