diff mbox

[v4,00/10] curl: fix curl read

Message ID 20130522111224.GS4515@redhat.com
State New
Headers show

Commit Message

Richard W.M. Jones May 22, 2013, 11:12 a.m. UTC
On Wed, May 22, 2013 at 01:04:51PM +0200, Paolo Bonzini wrote:
> Something is trying to write, but there's no write operation defined for
> CURL.
> 
> I guess curl (and other backends too) should reject being opened for
> write.  Alternatively, block.c could do that for them.

Yes, I'd just got to that conclusion as well :-)

The attached patch fixes the crash for me.

Rich.

Comments

Stefan Hajnoczi May 22, 2013, 2:39 p.m. UTC | #1
On Wed, May 22, 2013 at 12:12:24PM +0100, Richard W.M. Jones wrote:
> On Wed, May 22, 2013 at 01:04:51PM +0200, Paolo Bonzini wrote:
> > Something is trying to write, but there's no write operation defined for
> > CURL.
> > 
> > I guess curl (and other backends too) should reject being opened for
> > write.  Alternatively, block.c could do that for them.
> 
> Yes, I'd just got to that conclusion as well :-)
> 
> The attached patch fixes the crash for me.

Please post a top-level thread so that your patch gets picked up by
scripts and noticed by humans too :).

Alternatively Fam can include it in the next revision of this series.

Stefan
Fam Zheng May 23, 2013, 12:38 a.m. UTC | #2
On Wed, 05/22 16:39, Stefan Hajnoczi wrote:
> On Wed, May 22, 2013 at 12:12:24PM +0100, Richard W.M. Jones wrote:
> > On Wed, May 22, 2013 at 01:04:51PM +0200, Paolo Bonzini wrote:
> > > Something is trying to write, but there's no write operation defined for
> > > CURL.
> > > 
> > > I guess curl (and other backends too) should reject being opened for
> > > write.  Alternatively, block.c could do that for them.
> > 
> > Yes, I'd just got to that conclusion as well :-)
> > 
> > The attached patch fixes the crash for me.
> 
> Please post a top-level thread so that your patch gets picked up by
> scripts and noticed by humans too :).
> 
> Alternatively Fam can include it in the next revision of this series.
> 
> Stefan
> 

No problem, I'll post a new version to include it.
diff mbox

Patch

diff --git a/block/curl.c b/block/curl.c
index b8935fd..f1e302b 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -406,6 +406,10 @@  static int curl_open(BlockDriverState *bs, QDict *options, int flags)
 
     static int inited = 0;
 
+    if (flags & BDRV_O_RDWR) {
+        return -ENOTSUP;
+    }
+
     opts = qemu_opts_create_nofail(&runtime_opts);
     qemu_opts_absorb_qdict(opts, options, &local_err);
     if (error_is_set(&local_err)) {