Skip to content

Commit

Permalink
mISDN: return -EINVAL on error in dsp_control_req()
Browse files Browse the repository at this point in the history
If skb->len is too short then we should return an error.  Otherwise we
read beyond the end of skb->data for several bytes.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Dan Carpenter authored and davem330 committed Aug 30, 2013
1 parent 702821f commit 0d63c27
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/isdn/mISDN/dsp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb)
u8 *data;
int len;

if (skb->len < sizeof(int))
if (skb->len < sizeof(int)) {
printk(KERN_ERR "%s: PH_CONTROL message too short\n", __func__);
return -EINVAL;
}
cont = *((int *)skb->data);
len = skb->len - sizeof(int);
data = skb->data + sizeof(int);
Expand Down

0 comments on commit 0d63c27

Please sign in to comment.