netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mISDN: return -EINVAL on error in dsp_control_req()
@ 2013-08-29  8:47 Dan Carpenter
  2013-08-30 21:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-08-29  8:47 UTC (permalink / raw)
  To: Karsten Keil
  Cc: David S. Miller, Konstantin Khlebnikov, netdev, kernel-janitors

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 <dan.carpenter@oracle.com>

diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index 22b720e..77025f5 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] mISDN: return -EINVAL on error in dsp_control_req()
  2013-08-29  8:47 [patch] mISDN: return -EINVAL on error in dsp_control_req() Dan Carpenter
@ 2013-08-30 21:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-08-30 21:53 UTC (permalink / raw)
  To: dan.carpenter; +Cc: isdn, khlebnikov, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 29 Aug 2013 11:47:00 +0300

> 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 <dan.carpenter@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-30 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29  8:47 [patch] mISDN: return -EINVAL on error in dsp_control_req() Dan Carpenter
2013-08-30 21:53 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).