All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] block/vvfat: Fix crash when reporting error about too many files in directory
@ 2018-07-24 11:52 Thomas Huth
  2018-10-04  7:36 ` Thomas Huth
  2018-10-04 12:29 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2018-07-24 11:52 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: Max Reitz, qemu-devel

When using the vvfat driver with a directory that contains too many files,
QEMU currently crashes. This can be triggered like this for example:

 mkdir /tmp/vvfattest
 cd /tmp/vvfattest
 for ((x=0;x<=513;x++)); do mkdir $x; done
 qemu-system-x86_64 -drive \
   file.driver=vvfat,file.dir=.,read-only=on,media=cdrom

Seems like read_directory() is changing the mapping->path variable. Make
sure we use the right pointer instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 block/vvfat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/vvfat.c b/block/vvfat.c
index fc41841..f2e7d50 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -973,10 +973,10 @@ static int init_directories(BDRVVVFATState* s,
         mapping = array_get(&(s->mapping), i);
 
         if (mapping->mode & MODE_DIRECTORY) {
+            char *path = mapping->path;
             mapping->begin = cluster;
             if(read_directory(s, i)) {
-                error_setg(errp, "Could not read directory %s",
-                           mapping->path);
+                error_setg(errp, "Could not read directory %s", path);
                 return -1;
             }
             mapping = array_get(&(s->mapping), i);
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH v2] block/vvfat: Fix crash when reporting error about too many files in directory
  2018-07-24 11:52 [Qemu-devel] [PATCH v2] block/vvfat: Fix crash when reporting error about too many files in directory Thomas Huth
@ 2018-10-04  7:36 ` Thomas Huth
  2018-10-04 12:29 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2018-10-04  7:36 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel, Max Reitz

On 2018-07-24 13:52, Thomas Huth wrote:
> When using the vvfat driver with a directory that contains too many files,
> QEMU currently crashes. This can be triggered like this for example:
> 
>  mkdir /tmp/vvfattest
>  cd /tmp/vvfattest
>  for ((x=0;x<=513;x++)); do mkdir $x; done
>  qemu-system-x86_64 -drive \
>    file.driver=vvfat,file.dir=.,read-only=on,media=cdrom
> 
> Seems like read_directory() is changing the mapping->path variable. Make
> sure we use the right pointer instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  block/vvfat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/vvfat.c b/block/vvfat.c
> index fc41841..f2e7d50 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -973,10 +973,10 @@ static int init_directories(BDRVVVFATState* s,
>          mapping = array_get(&(s->mapping), i);
>  
>          if (mapping->mode & MODE_DIRECTORY) {
> +            char *path = mapping->path;
>              mapping->begin = cluster;
>              if(read_directory(s, i)) {
> -                error_setg(errp, "Could not read directory %s",
> -                           mapping->path);
> +                error_setg(errp, "Could not read directory %s", path);
>                  return -1;
>              }
>              mapping = array_get(&(s->mapping), i);
> 

Ping?

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

* Re: [Qemu-devel] [PATCH v2] block/vvfat: Fix crash when reporting error about too many files in directory
  2018-07-24 11:52 [Qemu-devel] [PATCH v2] block/vvfat: Fix crash when reporting error about too many files in directory Thomas Huth
  2018-10-04  7:36 ` Thomas Huth
@ 2018-10-04 12:29 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2018-10-04 12:29 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-block, Max Reitz, qemu-devel

Am 24.07.2018 um 13:52 hat Thomas Huth geschrieben:
> When using the vvfat driver with a directory that contains too many files,
> QEMU currently crashes. This can be triggered like this for example:
> 
>  mkdir /tmp/vvfattest
>  cd /tmp/vvfattest
>  for ((x=0;x<=513;x++)); do mkdir $x; done
>  qemu-system-x86_64 -drive \
>    file.driver=vvfat,file.dir=.,read-only=on,media=cdrom
> 
> Seems like read_directory() is changing the mapping->path variable. Make
> sure we use the right pointer instead.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, applied to the block branch.

Kevin

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

end of thread, other threads:[~2018-10-04 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 11:52 [Qemu-devel] [PATCH v2] block/vvfat: Fix crash when reporting error about too many files in directory Thomas Huth
2018-10-04  7:36 ` Thomas Huth
2018-10-04 12:29 ` Kevin Wolf

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.