All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix segfault during NBD iotest 083
@ 2021-02-12 11:16 Jagannathan Raman
  2021-02-12 11:16 ` [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault Jagannathan Raman
  0 siblings, 1 reply; 6+ messages in thread
From: Jagannathan Raman @ 2021-02-12 11:16 UTC (permalink / raw)
  To: berrange; +Cc: elena.ufimtseva, stefanha, qemu-devel

Hi,

The patch fixes a segfault issue. error_prepend() in
qio_channel_readv_full_all() sets a NULL *errp when
ret is 0.

We ran the following tests with this patch and they all passed:
- cd tests/qemu-iotests && ./check -nbd 083
- make check
- make check-iotests
- CI using Travis. We also kicked off gitlab CI, but didn't
  hear anything back from the server

Jagannathan Raman (1):
  io: error_prepend() in qio_channel_readv_full_all() causes segfault

 io/channel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
1.8.3.1



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

* [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
  2021-02-12 11:16 [PATCH] Fix segfault during NBD iotest 083 Jagannathan Raman
@ 2021-02-12 11:16 ` Jagannathan Raman
  2021-02-12 11:16   ` Daniel P. Berrangé
  0 siblings, 1 reply; 6+ messages in thread
From: Jagannathan Raman @ 2021-02-12 11:16 UTC (permalink / raw)
  To: berrange; +Cc: elena.ufimtseva, stefanha, qemu-devel

Using error_prepend() in qio_channel_readv_full_all() causes a segfault
as errp is not set when ret is 0. This results in the failure of iotest
83. Replacing with error_setg() fixes the problem.

Additionally, removes a full stop at the end of error message

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
 io/channel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/io/channel.c b/io/channel.c
index 4555021..e8b019d 100644
--- a/io/channel.c
+++ b/io/channel.c
@@ -202,8 +202,7 @@ int qio_channel_readv_full_all(QIOChannel *ioc,
     int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp);
 
     if (ret == 0) {
-        error_prepend(errp,
-                      "Unexpected end-of-file before all data were read.");
+        error_setg(errp, "Unexpected end-of-file before all data were read");
         return -1;
     }
     if (ret == 1) {
-- 
1.8.3.1



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

* Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
  2021-02-12 11:16 ` [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault Jagannathan Raman
@ 2021-02-12 11:16   ` Daniel P. Berrangé
  2021-02-12 11:41     ` Jag Raman
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrangé @ 2021-02-12 11:16 UTC (permalink / raw)
  To: Jagannathan Raman; +Cc: elena.ufimtseva, stefanha, qemu-devel

On Fri, Feb 12, 2021 at 06:16:07AM -0500, Jagannathan Raman wrote:
> Using error_prepend() in qio_channel_readv_full_all() causes a segfault
> as errp is not set when ret is 0. This results in the failure of iotest
> 83. Replacing with error_setg() fixes the problem.
> 
> Additionally, removes a full stop at the end of error message
> 
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
>  io/channel.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/io/channel.c b/io/channel.c
> index 4555021..e8b019d 100644
> --- a/io/channel.c
> +++ b/io/channel.c
> @@ -202,8 +202,7 @@ int qio_channel_readv_full_all(QIOChannel *ioc,
>      int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp);
>  
>      if (ret == 0) {
> -        error_prepend(errp,
> -                      "Unexpected end-of-file before all data were read.");
> +        error_setg(errp, "Unexpected end-of-file before all data were read");
>          return -1;
>      }
>      if (ret == 1) {

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
  2021-02-12 11:16   ` Daniel P. Berrangé
@ 2021-02-12 11:41     ` Jag Raman
  2021-02-12 13:08       ` Eric Blake
  0 siblings, 1 reply; 6+ messages in thread
From: Jag Raman @ 2021-02-12 11:41 UTC (permalink / raw)
  To: Daniel P. Berrangé, Peter Maydell
  Cc: Elena Ufimtseva, stefanha, qemu-devel



> On Feb 12, 2021, at 6:16 AM, Daniel P. Berrangé <berrange@redhat.com> wrote:
> 
> On Fri, Feb 12, 2021 at 06:16:07AM -0500, Jagannathan Raman wrote:
>> Using error_prepend() in qio_channel_readv_full_all() causes a segfault
>> as errp is not set when ret is 0. This results in the failure of iotest
>> 83. Replacing with error_setg() fixes the problem.
>> 
>> Additionally, removes a full stop at the end of error message
>> 
>> Reported-by: Max Reitz <mreitz@redhat.com>
>> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
>> ---
>> io/channel.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/io/channel.c b/io/channel.c
>> index 4555021..e8b019d 100644
>> --- a/io/channel.c
>> +++ b/io/channel.c
>> @@ -202,8 +202,7 @@ int qio_channel_readv_full_all(QIOChannel *ioc,
>>     int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, errp);
>> 
>>     if (ret == 0) {
>> -        error_prepend(errp,
>> -                      "Unexpected end-of-file before all data were read.");
>> +        error_setg(errp, "Unexpected end-of-file before all data were read");
>>         return -1;
>>     }
>>     if (ret == 1) {
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Thank you for reviewing, Daniel! I recall that you warned about
error_prepend() during the review, somehow slipped through.

Hi Peter,

    Could we send a PULL request for this patch?

Thank you!
--
Jag

> 
> 
> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


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

* Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
  2021-02-12 11:41     ` Jag Raman
@ 2021-02-12 13:08       ` Eric Blake
  2021-02-12 13:13         ` Jag Raman
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2021-02-12 13:08 UTC (permalink / raw)
  To: Jag Raman, Daniel P. Berrangé, Peter Maydell
  Cc: Elena Ufimtseva, stefanha, qemu-devel

On 2/12/21 5:41 AM, Jag Raman wrote:
> 
> 
>> On Feb 12, 2021, at 6:16 AM, Daniel P. Berrangé <berrange@redhat.com> wrote:
>>
>> On Fri, Feb 12, 2021 at 06:16:07AM -0500, Jagannathan Raman wrote:
>>> Using error_prepend() in qio_channel_readv_full_all() causes a segfault
>>> as errp is not set when ret is 0. This results in the failure of iotest
>>> 83. Replacing with error_setg() fixes the problem.
>>>
>>> Additionally, removes a full stop at the end of error message
>>>
>>> Reported-by: Max Reitz <mreitz@redhat.com>
>>> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
>>> ---
>>> io/channel.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)

>>
>> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> Thank you for reviewing, Daniel! I recall that you warned about
> error_prepend() during the review, somehow slipped through.
> 
> Hi Peter,
> 
>     Could we send a PULL request for this patch?

I'm bundling up a pull request for my NBD tree, and will include this one.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



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

* Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
  2021-02-12 13:08       ` Eric Blake
@ 2021-02-12 13:13         ` Jag Raman
  0 siblings, 0 replies; 6+ messages in thread
From: Jag Raman @ 2021-02-12 13:13 UTC (permalink / raw)
  To: Eric Blake
  Cc: Elena Ufimtseva, Peter Maydell, Daniel P. Berrangé,
	qemu-devel, stefanha



> On Feb 12, 2021, at 8:08 AM, Eric Blake <eblake@redhat.com> wrote:
> 
> On 2/12/21 5:41 AM, Jag Raman wrote:
>> 
>> 
>>> On Feb 12, 2021, at 6:16 AM, Daniel P. Berrangé <berrange@redhat.com> wrote:
>>> 
>>> On Fri, Feb 12, 2021 at 06:16:07AM -0500, Jagannathan Raman wrote:
>>>> Using error_prepend() in qio_channel_readv_full_all() causes a segfault
>>>> as errp is not set when ret is 0. This results in the failure of iotest
>>>> 83. Replacing with error_setg() fixes the problem.
>>>> 
>>>> Additionally, removes a full stop at the end of error message
>>>> 
>>>> Reported-by: Max Reitz <mreitz@redhat.com>
>>>> Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
>>>> ---
>>>> io/channel.c | 3 +--
>>>> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
>>> 
>>> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>> 
>> Thank you for reviewing, Daniel! I recall that you warned about
>> error_prepend() during the review, somehow slipped through.
>> 
>> Hi Peter,
>> 
>>    Could we send a PULL request for this patch?
> 
> I'm bundling up a pull request for my NBD tree, and will include this one.

Thank you very much, Eric! :)

> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org


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

end of thread, other threads:[~2021-02-12 13:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 11:16 [PATCH] Fix segfault during NBD iotest 083 Jagannathan Raman
2021-02-12 11:16 ` [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault Jagannathan Raman
2021-02-12 11:16   ` Daniel P. Berrangé
2021-02-12 11:41     ` Jag Raman
2021-02-12 13:08       ` Eric Blake
2021-02-12 13:13         ` Jag Raman

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.