]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Create: goto abort_locked instead of return 1 in error path
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 1 Mar 2023 20:41:29 +0000 (13:41 -0700)
committerJes Sorensen <jes@trained-monkey.org>
Mon, 13 Mar 2023 14:08:10 +0000 (10:08 -0400)
The return 1 after the fstat_is_blkdev() check should be replaced
with an error return that goes through the error path to unlock
resources locked by this function.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com>
Reviewed-by: Xiao Ni <xni@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Create.c

index 953e73722518b1fe5c36c3a4748bf70fcbbc9dd3..2e8203ecdccdc0398a3c220f0488001cc6da27ca 100644 (file)
--- a/Create.c
+++ b/Create.c
@@ -939,7 +939,7 @@ int Create(struct supertype *st, char *mddev,
                                                goto abort_locked;
                                        }
                                        if (!fstat_is_blkdev(fd, dv->devname, &rdev))
-                                               return 1;
+                                               goto abort_locked;
                                        inf->disk.major = major(rdev);
                                        inf->disk.minor = minor(rdev);
                                }