summaryrefslogtreecommitdiff
path: root/Detail.c
diff options
context:
space:
mode:
authorMike Lovell <mlovell@bluehost.com>2016-05-18 12:23:13 -0600
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-06-03 15:35:26 -0400
commit13db17bd1fcd68b5e5618fcd051ff4137f1ea413 (patch)
treefbba6f912d4251402a4a5ddd63d1fca678561ed4 /Detail.c
parentdf2647fa5bbe84960dae11531e34bafef549b8ff (diff)
downloadmdadm-13db17bd1fcd68b5e5618fcd051ff4137f1ea413.tar.gz
Use dev_t for devnm2devid and devid2devnm
Commit 4dd2df0966ec added a trip through makedev(), major(), and minor() for device major and minor numbers. This would cause mdadm to fail in operating on a device with a minor number bigger than (2^19)-1 due to it changing from dev_t to a signed int and back. Where this was found as a problem was when a array was created with a device specified as a name like /dev/md/raidname and there were already 128 arrays on the system. In this case, mdadm would chose 1048575 ((2^20)-1) for the array and minor number. This would cause the major and minor number to become negative when generated from devnm2devid() and passed to major() and minor() in open_dev_excl(). open_dev_excl() would then call dev_open() which would detect the negative minor number and call open() on the *char containing the major:minor pair which isn't a valid file. Signed-off-by: Mike Lovell <mlovell@bluehost.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'Detail.c')
-rw-r--r--Detail.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Detail.c b/Detail.c
index 20c4553..7a984c8 100644
--- a/Detail.c
+++ b/Detail.c
@@ -130,7 +130,7 @@ int Detail(char *dev, struct context *c)
/* This is a subarray of some container.
* We want the name of the container, and the member
*/
- int devid = devnm2devid(st->container_devnm);
+ dev_t devid = devnm2devid(st->container_devnm);
int cfd, err;
member = subarray;
@@ -577,7 +577,7 @@ This is pretty boring
char path[200];
char vbuf[1024];
int nlen = strlen(sra->sys_name);
- int devid;
+ dev_t devid;
if (de->d_name[0] == '.')
continue;
sprintf(path, "/sys/block/%s/md/metadata_version",