From: Maxim Levitsky <[email protected]>

major == 0 allocates dynamic major, not major == -1

I am submitting this for -stable because the negative major number
breaks LVM (regardless of whether any such devices are present).
I found this out the hard way when my system failed to boot.

This is in Linus' tree as 452380efbd72d8d41f53ea64c8a6ea1fedc4394d

The LVM breakage occurs due to how LVM's filtering is implemented;
in lib/filter/filter.c, lines 230-233:

        if ((line_maj <= 0) || (line_maj >= NUMBER_OF_MAJORS)) {
            blocksection = (line[i] == 'B') ? 1 : 0;
            continue;
        }

Basically, it scans through /proc/devices until it hits a line
starting with 'B', at which point it starts processing block major
numbers and whitelisting them to be used as PVs. However, the
negative number causes a problem because it a.) sorts to the top
of the list and b.) short-circuits the if(). This causes the
'blocksection' variable to flip back to zero immediately,
terminating the enumeration of permitted devices before any
actually get whitelisted. As a result, all block devices are
ignored, with messages such as

Skipping: Unrecognised LVM device type 259

259 being blkext, which LVM explicitly allows.

Signed-off-by: Alex Elsayed <[email protected]>
---
 drivers/mtd/sm_ftl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index 072ed59..9e2dfd5 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -1256,7 +1256,7 @@ static void sm_remove_dev(struct mtd_blktrans_dev *dev)
 
 static struct mtd_blktrans_ops sm_ftl_ops = {
        .name           = "smblk",
-       .major          = -1,
+       .major          = 0,
        .part_bits      = SM_FTL_PARTN_BITS,
        .blksize        = SM_SECTOR_SIZE,
        .getgeo         = sm_getgeo,
-- 
1.7.10.2

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to