Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-07-01 Thread Markus Armbruster
Paolo Bonzini  writes:

> On 01/07/20 09:06, Markus Armbruster wrote:
>> lichun  writes:
>> 
>>> Signed-off-by: lichun 
>>> ---
>>>  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, )) {
>>>  tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>>  check_report_connect_error(chr, err);
>>> -error_free(err);
>>>  goto cleanup;
>>>  }
>> 
>> Reviewed-by: Markus Armbruster 
>> 
>> 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.




Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-07-01 Thread Paolo Bonzini
On 01/07/20 17:12, lic...@ruijie.com.cn wrote:
>> On 01/07/20 09:06, Markus Armbruster wrote:
>>> lichun  writes:
>>>
 Signed-off-by: lichun 
 ---
   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, )) {
   tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
   check_report_connect_error(chr, err);
 -    error_free(err);
   goto cleanup;
   }
>>>
>>> Reviewed-by: Markus Armbruster 
>>>
>>> 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




Re: Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-07-01 Thread lichun
>On 01/07/20 09:06, Markus Armbruster wrote:
>> lichun  writes:
>>
>>> Signed-off-by: lichun 
>>> ---
>>>  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, )) {
>>>  tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>>  check_report_connect_error(chr, err);
>>> -    error_free(err);
>>>  goto cleanup;
>>>  }
>>
>> Reviewed-by: Markus Armbruster 
>>
>> 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.
>

Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-07-01 Thread Paolo Bonzini
On 01/07/20 09:06, Markus Armbruster wrote:
> lichun  writes:
> 
>> Signed-off-by: lichun 
>> ---
>>  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, )) {
>>  tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>>  check_report_connect_error(chr, err);
>> -error_free(err);
>>  goto cleanup;
>>  }
> 
> Reviewed-by: Markus Armbruster 
> 
> 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.




Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-07-01 Thread Markus Armbruster
lichun  writes:

> Signed-off-by: lichun 
> ---
>  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, )) {
>  tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
>  check_report_connect_error(chr, err);
> -error_free(err);
>  goto cleanup;
>  }

Reviewed-by: Markus Armbruster 

and queued, thanks!




Re: Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-06-27 Thread lichun
>Hi
>
>On Thu, Jun 25, 2020 at 10:47 AM Markus Armbruster  wrote:
>>
>> lichun  writes:
>>
>> > Signed-off-by: lichun 
>> > ---
>> >  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, )) {
>> >  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!
>

Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-06-25 Thread Marc-André Lureau
Hi

On Thu, Jun 25, 2020 at 10:47 AM Markus Armbruster  wrote:
>
> lichun  writes:
>
> > Signed-off-by: lichun 
> > ---
> >  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, )) {
> >  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!




Re: [PATCH v2] chardev/tcp: fix error message double free error

2020-06-25 Thread Markus Armbruster
lichun  writes:

> Signed-off-by: lichun 
> ---
>  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, )) {
>  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é.




[PATCH v2] chardev/tcp: fix error message double free error

2020-06-21 Thread lichun
Signed-off-by: lichun 
---
 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, )) {
 tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED);
 check_report_connect_error(chr, err);
-error_free(err);
 goto cleanup;
 }
 
-- 
2.18.4