]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen-blkback: really don't leak mode property
authorJan Beulich <JBeulich@suse.com>
Thu, 7 Jul 2016 07:38:13 +0000 (01:38 -0600)
committerBob Liu <bob.liu@oracle.com>
Thu, 20 Oct 2016 08:01:25 +0000 (04:01 -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>
(cherry picked from commit aea305e11f7a7af12aa2beb7c7e053a338659c49)
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Orabug: 24820937

drivers/block/xen-blkback/xenbus.c

index ec93a4d305d4b35df3012b281deedb0cfd048fcb..5cd2ba63119a317e5e73df85df3a00a61de07878 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;