From: Max Krasnyanskiy <maxk@qualcomm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] net: check for underlength tap writes
Date: Thu, 10 Apr 2008 11:19:38 -0700 [thread overview]
Message-ID: <47FE5A3A.9050109@qualcomm.com> (raw)
In-Reply-To: <200804052154.33636.rusty@rustcorp.com.au>
Ack. I've been meaning to fix this as well.
Dave, can please merge it.
Thanx
Max
Rusty Russell wrote:
> If the user gives a packet under 14 bytes, we'll end up reading off the end
> of the skb (not oopsing, just reading off the end).
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> diff -r 99132ad16999 drivers/net/tun.c
> --- a/drivers/net/tun.c Sat Apr 05 21:20:32 2008 +1100
> +++ b/drivers/net/tun.c Sat Apr 05 22:47:20 2008 +1100
> @@ -286,8 +286,11 @@ static __inline__ ssize_t tun_get_user(s
> return -EFAULT;
> }
>
> - if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV)
> + if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
> align = NET_IP_ALIGN;
> + if (unlikely(len < ETH_HLEN))
> + return -EINVAL;
> + }
>
> if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
> tun->dev->stats.rx_dropped++;
>
next prev parent reply other threads:[~2008-04-10 18:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-05 11:53 [PATCH 1/2] net: make struct tun_struct private to tun.c Rusty Russell
2008-04-05 11:54 ` [PATCH 2/2] net: check for underlength tap writes Rusty Russell
2008-04-10 18:19 ` Max Krasnyanskiy [this message]
2008-04-13 1:51 ` David Miller
2008-04-10 18:18 ` [PATCH 1/2] net: make struct tun_struct private to tun.c Max Krasnyanskiy
2008-04-13 1:49 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47FE5A3A.9050109@qualcomm.com \
--to=maxk@qualcomm.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).