xen-blkback: really don't leak mode property
authorJan Beulich <JBeulich@suse.com>
Thu, 7 Jul 2016 07:38:13 +0000 (01:38 -0600)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 22 Jul 2016 12:24:43 +0000 (08:24 -0400)
Commit 9d092603cc ("xen-blkback: do not leak mode property") left one
path unfixed; correct this.

Acked-by: Jens Axboe <axboe@kernel.dk>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkback/xenbus.c

index b44eaf40bb2993fd76909948e846bd583e002d18..4a2412127d8f6a18d00c7892642a0bae36ae3c9b 100644 (file)
@@ -715,8 +715,11 @@ static void backend_changed(struct xenbus_watch *watch,
 
        /* Front end dir is a number, which is used as the handle. */
        err = kstrtoul(strrchr(dev->otherend, '/') + 1, 0, &handle);
-       if (err)
+       if (err) {
+               kfree(be->mode);
+               be->mode = NULL;
                return;
+       }
 
        be->major = major;
        be->minor = minor;