Skip to content
  • Markus Armbruster's avatar
    1245402e
    9pfs: Fix CLI parsing crash on error · 1245402e
    Markus Armbruster authored
    
    
    Calling error_report() in a function that takes an Error ** argument
    is suspicious.  9p-handle.c's handle_parse_opts() does that, and then
    fails without setting an error.  Wrong.  Its caller crashes when it
    tries to report the error:
    
        $ qemu-system-x86_64 -nodefaults -fsdev id=foo,fsdriver=handle
        qemu-system-x86_64: -fsdev id=foo,fsdriver=handle: warning: handle backend is deprecated
        qemu-system-x86_64: -fsdev id=foo,fsdriver=handle: fsdev: No path specified
        Segmentation fault (core dumped)
    
    Screwed up when commit 91cda4e8 (v2.12.0) converted the function to
    Error.  Fix by calling error_setg() instead of error_report().
    
    Fixes: 91cda4e8
    Cc: Greg Kurz <groug@kaod.org>
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Acked-by: default avatarGreg Kurz <groug@kaod.org>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20181017082702.5581-9-armbru@redhat.com>
    1245402e
    9pfs: Fix CLI parsing crash on error
    Markus Armbruster authored
    
    
    Calling error_report() in a function that takes an Error ** argument
    is suspicious.  9p-handle.c's handle_parse_opts() does that, and then
    fails without setting an error.  Wrong.  Its caller crashes when it
    tries to report the error:
    
        $ qemu-system-x86_64 -nodefaults -fsdev id=foo,fsdriver=handle
        qemu-system-x86_64: -fsdev id=foo,fsdriver=handle: warning: handle backend is deprecated
        qemu-system-x86_64: -fsdev id=foo,fsdriver=handle: fsdev: No path specified
        Segmentation fault (core dumped)
    
    Screwed up when commit 91cda4e8 (v2.12.0) converted the function to
    Error.  Fix by calling error_setg() instead of error_report().
    
    Fixes: 91cda4e8
    Cc: Greg Kurz <groug@kaod.org>
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Acked-by: default avatarGreg Kurz <groug@kaod.org>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20181017082702.5581-9-armbru@redhat.com>
Loading