netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Hendry <andrew.hendry@gmail.com>
To: Matthew Daley <mattjd@gmail.com>
Cc: netdev@vger.kernel.org, Eric Dumazet <eric.dumazet@gmail.com>,
	stable <stable@kernel.org>
Subject: Re: [PATCH 3/3] x25: Prevent skb overreads when checking call user data
Date: Mon, 17 Oct 2011 21:28:24 +1100	[thread overview]
Message-ID: <CADo0ohgNR4XGQM1BnfDgHX2v42ov-obhfQpc-vbDHZ4oABx5zA@mail.gmail.com> (raw)
In-Reply-To: <1318653905-13716-4-git-send-email-mattjd@gmail.com>

Acked-by: Andrew Hendry <andrew.hendry@gmail.com>

On Sat, Oct 15, 2011 at 3:45 PM, Matthew Daley <mattjd@gmail.com> wrote:
> x25_find_listener does not check that the amount of call user data given
> in the skb is big enough in per-socket comparisons, hence buffer
> overreads may occur.  Fix this by adding a check.
>
> Signed-off-by: Matthew Daley <mattjd@gmail.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Andrew Hendry <andrew.hendry@gmail.com>
> Cc: stable <stable@kernel.org>
> ---
>  net/x25/af_x25.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
> index aa567b0..5f03e4e 100644
> --- a/net/x25/af_x25.c
> +++ b/net/x25/af_x25.c
> @@ -295,7 +295,8 @@ static struct sock *x25_find_listener(struct x25_address *addr,
>                         * Found a listening socket, now check the incoming
>                         * call user data vs this sockets call user data
>                         */
> -                       if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) {
> +                       if (x25_sk(s)->cudmatchlength > 0 &&
> +                               skb->len >= x25_sk(s)->cudmatchlength) {
>                                if((memcmp(x25_sk(s)->calluserdata.cuddata,
>                                        skb->data,
>                                        x25_sk(s)->cudmatchlength)) == 0) {
> --
> 1.7.2.5
>
>

  reply	other threads:[~2011-10-17 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15  4:45 x25: Fix multiple buffer overruns/overreads Matthew Daley
2011-10-15  4:45 ` [PATCH 1/3] x25: Validate incoming call user data lengths Matthew Daley
2011-10-15  4:45 ` [PATCH 2/3] x25: Handle undersized/fragmented skbs Matthew Daley
2011-10-17 10:28   ` Andrew Hendry
2011-10-15  4:45 ` [PATCH 3/3] x25: Prevent skb overreads when checking call user data Matthew Daley
2011-10-17 10:28   ` Andrew Hendry [this message]
2011-10-17 23:32 ` x25: Fix multiple buffer overruns/overreads 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=CADo0ohgNR4XGQM1BnfDgHX2v42ov-obhfQpc-vbDHZ4oABx5zA@mail.gmail.com \
    --to=andrew.hendry@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=mattjd@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@kernel.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;
as well as URLs for NNTP newsgroup(s).