[PATCH 03/19] Incremental(): Check return value of dev_open() before trying to use it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
---
 Incremental.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index 3596739..bc5e9d0 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -386,6 +386,12 @@ int Incremental(char *devname, int verbose, int runstop,
 			sprintf(dn, "%d:%d", sra->devs->disk.major,
 				sra->devs->disk.minor);
 			dfd2 = dev_open(dn, O_RDONLY);
+			if (dfd2 < 0) {
+				fprintf(stderr, Name
+					": unable to open %s\n", devname);
+				rv = 2;
+				goto out_unlock;
+			}
 			st2 = dup_super(st);
 			if (st2->ss->load_super(st2, dfd2, NULL) ||
 			    st->ss->compare_super(st, st2) != 0) {
-- 
1.7.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux