+ mmc-test-for-invalid-block-size.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     mmc: test for invalid block size

has been added to the -mm tree.  Its filename is

     mmc-test-for-invalid-block-size.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: mmc: test for invalid block size
From: Pierre Ossman <drzeus@xxxxxxxxx>


The controller has an upper limit on the block size.  Make sure we do not
cross it.

Signed-off-by: Pierre Ossman <drzeus@xxxxxxxxx>
Cc: Russell King <rmk@xxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/mmc/sdhci.c |   11 +++++++++++
 drivers/mmc/sdhci.h |    3 +++
 2 files changed, 14 insertions(+)

diff -puN drivers/mmc/sdhci.c~mmc-test-for-invalid-block-size drivers/mmc/sdhci.c
--- 25/drivers/mmc/sdhci.c~mmc-test-for-invalid-block-size	Tue Jun 27 14:28:41 2006
+++ 25-akpm/drivers/mmc/sdhci.c	Tue Jun 27 14:28:41 2006
@@ -328,6 +328,8 @@ static void sdhci_prepare_data(struct sd
 
 	/* Sanity checks */
 	BUG_ON((1 << data->blksz_bits) * data->blocks > 524288);
+	BUG_ON((1 << data->blksz_bits) > host->max_block);
+	BUG_ON(data->blocks > 65535);
 
 	/* timeout in us */
 	target_timeout = data->timeout_ns / 1000 +
@@ -1158,6 +1160,15 @@ static int __devinit sdhci_probe_slot(st
 	if (caps & SDHCI_TIMEOUT_CLK_UNIT)
 		host->timeout_clk *= 1000;
 
+	host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
+	if (host->max_block >= 3) {
+		printk(KERN_ERR "%s: Invalid maximum block size.\n",
+			host->slot_descr);
+		ret = -ENODEV;
+		goto unmap;
+	}
+	host->max_block = 512 << host->max_block;
+
 	/*
 	 * Set host parameters.
 	 */
diff -puN drivers/mmc/sdhci.h~mmc-test-for-invalid-block-size drivers/mmc/sdhci.h
--- 25/drivers/mmc/sdhci.h~mmc-test-for-invalid-block-size	Tue Jun 27 14:28:41 2006
+++ 25-akpm/drivers/mmc/sdhci.h	Tue Jun 27 14:28:41 2006
@@ -131,6 +131,8 @@
 #define  SDHCI_TIMEOUT_CLK_UNIT	0x00000080
 #define  SDHCI_CLOCK_BASE_MASK	0x00003F00
 #define  SDHCI_CLOCK_BASE_SHIFT	8
+#define  SDHCI_MAX_BLOCK_MASK	0x00030000
+#define  SDHCI_MAX_BLOCK_SHIFT  16
 #define  SDHCI_CAN_DO_DMA	0x00400000
 #define  SDHCI_CAN_VDD_330	0x01000000
 #define  SDHCI_CAN_VDD_300	0x02000000
@@ -161,6 +163,7 @@ struct sdhci_host {
 
 	unsigned int		max_clk;	/* Max possible freq (MHz) */
 	unsigned int		timeout_clk;	/* Timeout freq (KHz) */
+	unsigned int		max_block;	/* Max block size (bytes) */
 
 	unsigned int		clock;		/* Current clock (MHz) */
 	unsigned short		power;		/* Current voltage */
_

Patches currently in -mm which might be from drzeus@xxxxxxxxx are

mmc-check-sdhci-base-clock.patch
mmc-print-device-id.patch
mmc-support-for-multiple-voltages.patch
mmc-fix-timeout-loops-in-sdhci.patch
mmc-fix-sdhci-reset-timeout.patch
mmc-proper-timeout-handling.patch
mmc-correct-register-order.patch
mmc-fix-interrupt-handling.patch
mmc-fix-sdhci-pio-routines.patch
mmc-avoid-sdhci-dma-boundaries.patch
mmc-test-for-invalid-block-size.patch
mmc-check-only-relevant-inhibit-bits.patch
mmc-check-controller-version.patch
mmc-reset-sdhci-controller-early.patch
mmc-more-dma-capabilities-tests.patch
mmc-support-controller-specific-quirks.patch
mmc-version-bump-sdhci.patch
mmc-add-sdhci-controller-ids.patch
mmc-quirk-for-broken-reset.patch
mmc-force-dma-on-some-controllers.patch
mmc-remove-duplicate-error-message.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux