Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 221953
b: refs/heads/master
c: eccbf04
h: refs/heads/master
i:
  221951: 2e74198
v: v3
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Nov 9, 2010
1 parent 740ed89 commit 308e871
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4fc718a4b0cdf3803f370e323ea5252a3d76f52d
refs/heads/master: eccbf04a904fc99c54ab37c29a2a4dedcec66e33
49 changes: 32 additions & 17 deletions trunk/drivers/staging/bcm/Bcmchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,13 +1001,15 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}
#endif
case IOCTL_BE_BUCKET_SIZE:
Adapter->BEBucketSize = *(PULONG)arg;
Status = STATUS_SUCCESS;
Status = 0;
if (get_user(Adapter->BEBucketSize, (unsigned long __user *)arg))
Status = -EFAULT;
break;

case IOCTL_RTPS_BUCKET_SIZE:
Adapter->rtPSBucketSize = *(PULONG)arg;
Status = STATUS_SUCCESS;
Status = 0;
if (get_user(Adapter->rtPSBucketSize, (unsigned long __user *)arg))
Status = -EFAULT;
break;
case IOCTL_CHIP_RESET:
{
Expand All @@ -1028,11 +1030,15 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
case IOCTL_QOS_THRESHOLD:
{
USHORT uiLoopIndex;
for(uiLoopIndex = 0 ; uiLoopIndex < NO_OF_QUEUES ; uiLoopIndex++)
{
Adapter->PackInfo[uiLoopIndex].uiThreshold = *(PULONG)arg;

Status = 0;
for (uiLoopIndex = 0; uiLoopIndex < NO_OF_QUEUES; uiLoopIndex++) {
if (get_user(Adapter->PackInfo[uiLoopIndex].uiThreshold,
(unsigned long __user *)arg)) {
Status = -EFAULT;
break;
}
}
Status = STATUS_SUCCESS;
break;
}

Expand Down Expand Up @@ -1093,21 +1099,28 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}
case IOCTL_BCM_GET_CURRENT_STATUS:
{
LINK_STATE *plink_state = NULL;
LINK_STATE plink_state;

/* Copy Ioctl Buffer structure */
if(copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
{
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "copy_from_user failed..\n");
Status = -EFAULT;
break;
}
plink_state = (LINK_STATE*)arg;
plink_state->bIdleMode = (UCHAR)Adapter->IdleMode;
plink_state->bShutdownMode = Adapter->bShutStatus;
plink_state->ucLinkStatus = (UCHAR)Adapter->LinkStatus;
if(copy_to_user(IoBuffer.OutputBuffer,
(PUCHAR)plink_state, (UINT)IoBuffer.OutputLength))
{
if (IoBuffer.OutputLength != sizeof(plink_state)) {
Status = -EINVAL;
break;
}

if (copy_from_user(&plink_state, (void __user *)arg, sizeof(plink_state))) {
Status = -EFAULT;
break;
}
plink_state.bIdleMode = (UCHAR)Adapter->IdleMode;
plink_state.bShutdownMode = Adapter->bShutStatus;
plink_state.ucLinkStatus = (UCHAR)Adapter->LinkStatus;
if (copy_to_user(IoBuffer.OutputBuffer, &plink_state, IoBuffer.OutputLength)) {
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Copy_to_user Failed..\n");
Status = -EFAULT;
break;
Expand Down Expand Up @@ -1331,7 +1344,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Copy From User space failed. status :%d", Status);
return -EFAULT;
}
uiSectorSize = *((PUINT)(IoBuffer.InputBuffer)); /* FIXME: unchecked __user access */
if (get_user(uiSectorSize, (unsigned int __user *)IoBuffer.InputBuffer))
return -EFAULT;

if((uiSectorSize < MIN_SECTOR_SIZE) || (uiSectorSize > MAX_SECTOR_SIZE))
{

Expand Down

0 comments on commit 308e871

Please sign in to comment.