From: Jes Sorensen Date: Tue, 1 Nov 2011 15:09:19 +0000 (+0100) Subject: Incremental(): Check return value of dev_open() before trying to use it X-Git-Tag: mdadm-3.2.3~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb745c4bb4e9e788c96510f6be57d2d973e9a3fb;p=thirdparty%2Fmdadm.git Incremental(): Check return value of dev_open() before trying to use it Signed-off-by: Jes Sorensen Signed-off-by: NeilBrown --- diff --git a/Incremental.c b/Incremental.c index 35967391..bc5e9d09 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) {