sdio: check that addresses are within the address space
authorPierre Ossman <drzeus@drzeus.cx>
Thu, 5 Mar 2009 18:40:27 +0000 (19:40 +0100)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 24 Mar 2009 20:30:00 +0000 (21:30 +0100)
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/core/sdio_ops.c

index c8fa095a4488689bb9ae35dee41bd482abe3a157..4eb7825fd1a74ce26618c38d27d3b780cc21556d 100644 (file)
@@ -76,6 +76,10 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
        BUG_ON(!card);
        BUG_ON(fn > 7);
 
+       /* sanity check */
+       if (addr & ~0x1FFFF)
+               return -EINVAL;
+
        memset(&cmd, 0, sizeof(struct mmc_command));
 
        cmd.opcode = SD_IO_RW_DIRECT;
@@ -125,6 +129,10 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
        WARN_ON(blocks == 0);
        WARN_ON(blksz == 0);
 
+       /* sanity check */
+       if (addr & ~0x1FFFF)
+               return -EINVAL;
+
        memset(&mrq, 0, sizeof(struct mmc_request));
        memset(&cmd, 0, sizeof(struct mmc_command));
        memset(&data, 0, sizeof(struct mmc_data));