b1c0ea9cf1
Add 0067-kpartx-hold-device-open-until-partitions-have-been-c.patch * Fixes bz #2141860 Add 0068-libmultipath-cleanup-remove_feature.patch Add 0069-libmultipath-cleanup-add_feature.patch Add 0070-multipath-tests-tests-for-adding-and-removing-featur.patch Add 0071-libmultipath-fix-queue_mode-feature-handling.patch Add 0072-multipath-tests-tests-for-reconcile_features_with_qu.patch Add 0073-libmultipath-prepare-proto_id-for-use-by-non-scsi-de.patch Add 0074-libmultipath-get-nvme-path-transport-protocol.patch Add 0075-libmultipath-enforce-queue_mode-bio-for-nmve-tcp-pat.patch * Fixes bz #2033080 Resolves: bz #2033080, #2141860
48 lines
1.3 KiB
Diff
48 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Wed, 19 Oct 2022 12:57:10 -0500
|
|
Subject: [PATCH] kpartx: hold device open until partitions have been created
|
|
|
|
kpartx was closing the whole device after it read the partition
|
|
information off it. This allowed a race, where the device could be
|
|
removed and another one created with the same major:minor, after kpartx
|
|
read the partition information but before it created the partition
|
|
devices.
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
---
|
|
kpartx/kpartx.c | 11 +++--------
|
|
1 file changed, 3 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
|
|
index 7bc64543..e79fdd4a 100644
|
|
--- a/kpartx/kpartx.c
|
|
+++ b/kpartx/kpartx.c
|
|
@@ -443,12 +443,7 @@ main(int argc, char **argv){
|
|
if (n >= 0)
|
|
printf("%s: %d slices\n", ptp->type, n);
|
|
#endif
|
|
-
|
|
- if (n > 0) {
|
|
- close(fd);
|
|
- fd = -1;
|
|
- }
|
|
- else
|
|
+ if (n <= 0)
|
|
continue;
|
|
|
|
switch(what) {
|
|
@@ -668,9 +663,9 @@ main(int argc, char **argv){
|
|
if (n > 0)
|
|
break;
|
|
}
|
|
+ if (fd != -1)
|
|
+ close(fd);
|
|
if (what == LIST && loopcreated) {
|
|
- if (fd != -1)
|
|
- close(fd);
|
|
if (del_loop(device)) {
|
|
if (verbose)
|
|
fprintf(stderr, "can't del loop : %s\n",
|