diff options
author | Kevin McKinney <klmckinney1@gmail.com> | 2011-09-18 18:34:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-19 13:46:17 -0400 |
commit | e228b7426e65df0f2e93c783c2c89baabe318b9b (patch) | |
tree | 0ebdfdcd307d57ae2f5137e70e7192cfbb3dad42 /drivers/staging/bcm/Misc.c | |
parent | 5ac5bd8754b3dabcf4aea7b5f4a28a1d8494a1b0 (diff) |
Staging: bcm: Add size maximum size restrictions for IOCTL_IDLE_REQ
In the first alteration, the MAX_CNTL_PKT_SIZE is the
maximum size of the control packet in ->Adapter->txctlpacket[]
which is defined in InitAdapter(). This caps the size of
kmalloc memory allocation. In the second change, this max
cap fixes a potential memory corruption bug when subsequent
memset and memcpy calls are invoked.
Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/bcm/Misc.c')
-rw-r--r-- | drivers/staging/bcm/Misc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index c5b3a3666bc..9da94086987 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c | |||
@@ -421,6 +421,10 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter,/**<Logical Adapter*/ | |||
421 | pLeader->PLength = pktlen; | 421 | pLeader->PLength = pktlen; |
422 | } | 422 | } |
423 | } | 423 | } |
424 | |||
425 | if (pktlen + LEADER_SIZE > MAX_CNTL_PKT_SIZE) | ||
426 | return -EINVAL; | ||
427 | |||
424 | memset(ctrl_buff, 0, pktlen+LEADER_SIZE); | 428 | memset(ctrl_buff, 0, pktlen+LEADER_SIZE); |
425 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Copying the Control Packet Buffer with length=%d\n", pLeader->PLength); | 429 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Copying the Control Packet Buffer with length=%d\n", pLeader->PLength); |
426 | *(PLEADER)ctrl_buff=*pLeader; | 430 | *(PLEADER)ctrl_buff=*pLeader; |