On Wed, Apr 05, 2017 at 02:28:44PM -0400, Jeff Cody wrote:
> @@ -1173,7 +1171,18 @@ static int vvfat_open(BlockDriverState *bs, QDict 
> *options, int flags,
>          if (ret < 0) {
>              goto fail;
>          }
> -        bdrv_set_read_only(bs, false);
> +        ret = bdrv_set_read_only(bs, false, &local_err);
> +        if (ret < 0) {
> +            error_propagate(errp, local_err);
> +            goto fail;
> +        }

I realized later in the series why you are doing this.

The error code path introduces a resource leak: enable_write_target()
has already been called and isn't cleaned up by the fail label.

It would be cleaner to check that bs is writable before calling
enable_write_target().

Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to