qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes.
@ 2013-05-22 15:01 Richard W.M. Jones
  2013-05-23  0:39 ` Fam Zheng
  0 siblings, 1 reply; 5+ messages in thread
From: Richard W.M. Jones @ 2013-05-22 15:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: famz

From: "Richard W.M. Jones" <rjones@redhat.com>

---
 block/curl.c | 4 ++++
 1 file changed, 4 insertions(+)

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)) {
-- 
1.8.2.1

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

* Re: [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes.
  2013-05-22 15:01 Richard W.M. Jones
@ 2013-05-23  0:39 ` Fam Zheng
  0 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2013-05-23  0:39 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: qemu-devel

On Wed, 05/22 16:01, Richard W.M. Jones wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> ---
>  block/curl.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> 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)) {
> -- 
> 1.8.2.1
> 

Thanks, I'll include this in the new version of my series.

-- 
Fam

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

* [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes.
@ 2013-06-10 10:06 Richard W.M. Jones
  2013-06-10 10:06 ` Richard W.M. Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Richard W.M. Jones @ 2013-06-10 10:06 UTC (permalink / raw)
  To: qemu-trivial; +Cc: kwolf, qemu-devel, stefanha

This simple patch avoids a segfault in qemu if the user tries to open
a curl disk for writing.

This was previously part of Fam Zheng's curl patch series, but it
stands alone and we shouldn't forget about it.

Rich.

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

* [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes.
  2013-06-10 10:06 [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes Richard W.M. Jones
@ 2013-06-10 10:06 ` Richard W.M. Jones
  2013-06-10 11:24   ` Kevin Wolf
  0 siblings, 1 reply; 5+ messages in thread
From: Richard W.M. Jones @ 2013-06-10 10:06 UTC (permalink / raw)
  To: qemu-trivial; +Cc: kwolf, qemu-devel, stefanha

From: "Richard W.M. Jones" <rjones@redhat.com>

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/curl.c | 4 ++++
 1 file changed, 4 insertions(+)

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)) {
-- 
1.8.2.1

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

* Re: [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes.
  2013-06-10 10:06 ` Richard W.M. Jones
@ 2013-06-10 11:24   ` Kevin Wolf
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2013-06-10 11:24 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: qemu-trivial, qemu-devel, stefanha

Am 10.06.2013 um 12:06 hat Richard W.M. Jones geschrieben:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/curl.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> 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;
> +    }
> +

Thanks, I applied this patch to the block branch for now, but I think a
v2 with some better error reporting wouldn't hurt. We can either add a
qerror_report() call or at least change the error code to -EROFS or
something like that.

Kevin

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

end of thread, other threads:[~2013-06-10 11:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-10 10:06 [Qemu-devel] [PATCH] block/curl.c: Refuse to open the handle for writes Richard W.M. Jones
2013-06-10 10:06 ` Richard W.M. Jones
2013-06-10 11:24   ` Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2013-05-22 15:01 Richard W.M. Jones
2013-05-23  0:39 ` Fam Zheng

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).