netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: amwang@redhat.com
Cc: netdev@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [Patch v2 1/5] pktgen: fix crash when generating IPv6 packets
Date: Wed, 10 Oct 2012 22:33:54 -0400 (EDT)	[thread overview]
Message-ID: <20121010.223354.756507387487997570.davem@davemloft.net> (raw)
In-Reply-To: <1349840900-24138-1-git-send-email-amwang@redhat.com>

From: Cong Wang <amwang@redhat.com>
Date: Wed, 10 Oct 2012 11:48:16 +0800

> For IPv6, sizeof(struct ipv6hdr) = 40, thus the following
> expression will result negative:
> 
>         datalen = pkt_dev->cur_pkt_size - 14 -
>                   sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
>                   pkt_dev->pkt_overhead;
> 
> And,  the check "if (datalen < sizeof(struct pktgen_hdr))" will be
> passed as "datalen" is promoted to unsigned, therefore will cause
> a crash later.
> 
> This is a quick fix by checking if "datalen" is negative. The following
> patch will increase the default value of 'min_pkt_size' for IPv6.
> 
> This bug should exist for a long time, so Cc -stable too.
> 
> Cc: <stable@vger.kernel.org>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>

Applied.

      parent reply	other threads:[~2012-10-11  2:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10  3:48 [Patch v2 1/5] pktgen: fix crash when generating IPv6 packets Cong Wang
2012-10-10  3:48 ` [Patch v2 2/5] pktgen: set different default min_pkt_size for different protocols Cong Wang
2012-10-11  2:34   ` David Miller
2012-10-10  3:48 ` [Patch v2 3/5] pktgen: display IPv4 address in human-readable format Cong Wang
2012-10-11  2:34   ` David Miller
2012-10-10  3:48 ` [Patch v2 4/5] pktgen: enable automatic IPv6 address setting Cong Wang
2012-10-11  2:34   ` David Miller
2012-10-10  3:48 ` [Patch v2 5/5] pktgen: replace scan_ip6() with in6_pton() Cong Wang
2012-10-11  2:34   ` David Miller
2012-10-11  2:33 ` David Miller [this message]

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=20121010.223354.756507387487997570.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=amwang@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.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).