Blame SOURCES/0032-kpartx-fail-if-dup-of-dasd-file-descriptor-fails.patch

a1c519
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a1c519
From: Benjamin Marzinski <bmarzins@redhat.com>
a1c519
Date: Thu, 16 May 2019 12:55:16 -0500
a1c519
Subject: [PATCH] kpartx: fail if dup() of dasd file descriptor fails
a1c519
a1c519
If kpartx fails to create a copy of the dasd file descriptor, it should
a1c519
fail, instead of treating the error value as a valid fd. Found by
a1c519
coverity.
a1c519
a1c519
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
a1c519
---
a1c519
 kpartx/dasd.c | 2 ++
a1c519
 1 file changed, 2 insertions(+)
a1c519
a1c519
diff --git a/kpartx/dasd.c b/kpartx/dasd.c
a1c519
index 61b609a..d95d8ca 100644
a1c519
--- a/kpartx/dasd.c
a1c519
+++ b/kpartx/dasd.c
a1c519
@@ -138,6 +138,8 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
a1c519
 			return -1;
a1c519
 	} else {
a1c519
 		fd_dasd = dup(fd);
a1c519
+		if (fd_dasd < 0)
a1c519
+			return -1;
a1c519
 	}
a1c519
 
a1c519
 	if (ioctl(fd_dasd, BIODASDINFO, (unsigned long)&info) != 0) {
a1c519
-- 
a1c519
2.17.2
a1c519