brcmfmac: Increase max buffer size for receiving control message from dongle
authorDaniel Kim <dekim@broadcom.com>
Tue, 27 May 2014 10:56:26 +0000 (12:56 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 May 2014 17:10:26 +0000 (13:10 -0400)
The max buffer size for receiving control message from dongle needs to be
increased considering possible block padding. Otherwise some big control
message can't be received due to buffer overrun check.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Daniel Kim <dekim@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c

index 506ef0d4a52b95785385f9a3530a2c3b0ead5a7b..8fa0dbbbda72b6ed1d1dc84020594287cf595a37 100644 (file)
@@ -4086,8 +4086,13 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
                goto fail;
        }
 
+       /* Query the F2 block size, set roundup accordingly */
+       bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
+       bus->roundup = min(max_roundup, bus->blocksize);
+
        /* Allocate buffers */
        if (bus->sdiodev->bus_if->maxctl) {
+               bus->sdiodev->bus_if->maxctl += bus->roundup;
                bus->rxblen =
                    roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN),
                            ALIGNMENT) + bus->head_align;
@@ -4115,10 +4120,6 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
        bus->idletime = BRCMF_IDLE_INTERVAL;
        bus->idleclock = BRCMF_IDLE_ACTIVE;
 
-       /* Query the F2 block size, set roundup accordingly */
-       bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
-       bus->roundup = min(max_roundup, bus->blocksize);
-
        /* SR state */
        bus->sleeping = false;
        bus->sr_enabled = false;