From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: dbaryshkov@gmail.com, slapin@ossfans.org, davem@davemloft.net,
linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ieee802154: verify packet size before trying to allocate it
Date: Sun, 10 Jun 2012 12:24:35 +0100 [thread overview]
Message-ID: <20120610122435.7d5c8fa7@pyramind.ukuu.org.uk> (raw)
In-Reply-To: <1339326619-1753-1-git-send-email-levinsasha928@gmail.com>
On Sun, 10 Jun 2012 13:10:19 +0200
Sasha Levin <levinsasha928@gmail.com> wrote:
> Currently when sending data over datagram, the send function will attempt to
> allocate any size passed on from the userspace.
>
> We should make sure that this size is checked and limited. The maximum size
> of an IP packet seemed like the safest limit here.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>
> Change in v2:
> - Limit by maximum size the protocol supports.
>
> net/ieee802154/dgram.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
> index 6fbb2ad..628498c 100644
> --- a/net/ieee802154/dgram.c
> +++ b/net/ieee802154/dgram.c
> @@ -232,6 +232,11 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk,
>
> hlen = LL_RESERVED_SPACE(dev);
> tlen = dev->needed_tailroom;
> + if (hlen + tlen + size > IEEE802154_MTU) {
> + err = -EMSGSIZE;
> + goto out;
What stops an overflow at this point. We'll then pass a small value to
sock_alloc_send_skb/sock_alloc_send_pskb and copy a large number of bytes
into it.
This does seem to be already broken, and not fixed by the patch ?
Alan
next prev parent reply other threads:[~2012-06-10 11:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-10 11:10 [PATCH] ieee802154: verify packet size before trying to allocate it Sasha Levin
2012-06-10 11:24 ` Alan Cox [this message]
2012-06-10 12:16 ` Sasha Levin
2012-06-10 12:55 ` Jan Ceuleers
2012-06-11 3:04 ` David Miller
2012-06-11 8:18 ` Sasha Levin
-- strict thread matches above, loose matches on Subject: below --
2012-06-06 21:32 Sasha Levin
2012-06-07 20:10 ` 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=20120610122435.7d5c8fa7@pyramind.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=dbaryshkov@gmail.com \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-zigbee-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=slapin@ossfans.org \
/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