Fix segfault during NBD iotest 083
PATCH 1/1 Fix segfault during NBD iotest 083
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(-)
Signature · 1 line
1.8.3.1
Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
In reply to Jagannathan RamanQuoted 17 lines · Jagannathan Raman
Using
error_prepend()inqio_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 witherror_setg()fixes the problem.Additionally, removes a full stop at the end of error message
Reported-by Max Reitz <[email protected]>Signed-off-by Jagannathan Raman <[email protected]>--- io/channel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)io/channel.c +0
-0
io/channel.c int qio_channel_readv_full_all(QIOChannel *ioc, · line 208
Quoted 9 lines
io/channel.c +1
-2@@ -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 ) {
Regards,
Daniel
Signature · 3 lines
|: 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 :|
PATCH 1/1 io: error_prepend() in qio_channel_readv_full_all() causes segfault
In reply to Jagannathan RamanUsing 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
--- io/channel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
io/channel.c +1 -2
@@ -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 ) {
Signature · 1 line
1.8.3.1
Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
In reply to Daniel P. BerrangéQuoted 24 lines · Daniel P. Berrangé
Quoted 19 lines · Jagannathan Raman
Using
error_prepend()inqio_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 witherror_setg()fixes the problem.Additionally, removes a full stop at the end of error message
Reported-by Max Reitz <[email protected]>Signed-off-by Jagannathan Raman <[email protected]>---
io/channel.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)io/channel.c +0
-0@@ -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);
Quoted 9 lines
io/channel.c int qio_channel_readv_full_all(QIOChannel *ioc, · line 208
Quoted 7 lines
io/channel.c +1
-2if (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é <[email protected]>
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
Quoted 8 lines
Regards,
DanielSignature · 3 lines
|: 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 :|
Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
Quoted 18 lines · Jag Raman
Quoted 18 lines · Daniel P. Berrangé
Quoted 11 lines · Jagannathan Raman
Using
error_prepend()inqio_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 witherror_setg()fixes the problem.Additionally, removes a full stop at the end of error message
Reported-by Max Reitz <[email protected]>Signed-off-by Jagannathan Raman <[email protected]>---
io/channel.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 8 lines
Quoted 1 line
Reviewed-by Daniel P. Berrangé <[email protected]>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.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH] io: error_prepend() in qio_channel_readv_full_all() causes segfault
Quoted 25 lines · Eric Blake
Quoted 20 lines · Jag Raman
Quoted 19 lines · Daniel P. Berrangé
Quoted 11 lines · Jagannathan Raman
Using
error_prepend()inqio_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 witherror_setg()fixes the problem.Additionally, removes a full stop at the end of error message
Reported-by Max Reitz <[email protected]>Signed-off-by Jagannathan Raman <[email protected]>---
io/channel.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)Reviewed-by Daniel P. Berrangé <[email protected]>
Quoted 8 lines
Quoted 6 lines
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! :)
Quoted 5 lines
Signature · 4 lines
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org