diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-01-29 15:59:53 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-02-25 07:40:19 -0500 |
commit | 4d3a8534bdbcf4843fc8ad05c9a81a964fc65237 (patch) | |
tree | b019c9174a67fb23159fd4211baf099bf7a2e2a6 /drivers/mtd/mtd_blkdevs.c | |
parent | b520e412faaaad35641aeedd6059179f9f1b393c (diff) |
mtd: Raise limit on block device minor numbers
add_mtd_blktrans_dev() imposes a maximum of 257 devices per block
translator. This was presumably meant to prevent overflow back in the
days of 8-bit minor numbers. Instead, check against MINORMASK and the
limits of the partition naming scheme.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 85a52b3c7698..2f8c202dbd86 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -242,9 +242,12 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) | |||
242 | if (new->devnum == -1) | 242 | if (new->devnum == -1) |
243 | new->devnum = last_devnum+1; | 243 | new->devnum = last_devnum+1; |
244 | 244 | ||
245 | if ((new->devnum << tr->part_bits) > 256) { | 245 | /* Check that the device and any partitions will get valid |
246 | * minor numbers and that the disk naming code below can cope | ||
247 | * with this number. */ | ||
248 | if (new->devnum > (MINORMASK >> tr->part_bits) || | ||
249 | (tr->part_bits && new->devnum >= 27 * 26)) | ||
246 | return -EBUSY; | 250 | return -EBUSY; |
247 | } | ||
248 | 251 | ||
249 | list_add_tail(&new->list, &tr->devs); | 252 | list_add_tail(&new->list, &tr->devs); |
250 | added: | 253 | added: |