X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=block%2Fgenhd.c;h=e1eadcc9546a72ec0d1c76d933143767dd357536;hb=402a917aca5daca69fcc91f43e6f1e6939cf393b;hp=397960cf26afcd61fc7c2bba2365944c8485c767;hpb=73d59314e6ed268d6f322ae1bdd723b23fa5a4ed;p=sfrench%2Fcifs-2.6.git diff --git a/block/genhd.c b/block/genhd.c index 397960cf26af..e1eadcc9546a 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1087,6 +1087,14 @@ dev_t blk_lookup_devt(const char *name, int partno) if (strcmp(dev_name(dev), name)) continue; + if (partno < disk->minors) { + /* We need to return the right devno, even + * if the partition doesn't exist yet. + */ + devt = MKDEV(MAJOR(dev->devt), + MINOR(dev->devt) + partno); + break; + } part = disk_get_part(disk, partno); if (part) { devt = part_devt(part);