public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: emohandesi@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: joe.hershberger@ni.com, rfried.dev@gmail.com,
	v.v.mitrofanov@yadro.com, sjg@chromium.org,
	emohandesi@linux.microsoft.com, saproj@gmail.com
Subject: [PATCH 1/2] net: ipv6: router advertisement message length should be within limits
Date: Thu, 18 May 2023 11:24:38 -0700	[thread overview]
Message-ID: <1684434279-1065-2-git-send-email-emohandesi@linux.microsoft.com> (raw)
In-Reply-To: <1684434279-1065-1-git-send-email-emohandesi@linux.microsoft.com>

From: Ehsan Mohandesi <emohandesi@linux.microsoft.com>

The argument len passed to function process_ra is the length of the IPv6
router advertisement message and needs to be between 0 and MTU because
it is assigned to remaining_option_len and used as a loop variable.

Addresses-Coverity-ID: 450971 ("TAINTED_SCALAR")
Signed-off-by: Ehsan Mohandesi <emohandesi@linux.microsoft.com>
---
 net/ndisc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ndisc.c b/net/ndisc.c
index 0b27779..d1cec06 100644
--- a/net/ndisc.c
+++ b/net/ndisc.c
@@ -382,6 +382,8 @@ int process_ra(struct ip6_hdr *ip6, int len)
 	unsigned char type = 0;
 	struct icmp6_ra_prefix_info *prefix = NULL;
 
+	if (len > ETH_MAX_MTU)
+		return -EMSGSIZE;
 	/* Ignore the packet if router lifetime is 0. */
 	if (!icmp->icmp6_rt_lifetime)
 		return -EOPNOTSUPP;
-- 
1.8.3.1


  reply	other threads:[~2023-05-18 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 18:24 [PATCH 0/2] IPv6 Network Discovery Boundary Variable and Packed Structure emohandesi
2023-05-18 18:24 ` emohandesi [this message]
2023-05-19  7:09   ` [PATCH 1/2] net: ipv6: router advertisement message length should be within limits Vyacheslav V. Mitrofanov
2023-06-10 10:44   ` Ramon Fried
2023-07-27 20:46   ` Tom Rini
2023-05-18 18:24 ` [PATCH 2/2] net: ipv6: network protocol structures should be packed emohandesi
2023-05-19  7:12   ` Vyacheslav V. Mitrofanov
2023-06-10 10:45   ` Ramon Fried
2023-07-27 20:46   ` Tom Rini

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=1684434279-1065-2-git-send-email-emohandesi@linux.microsoft.com \
    --to=emohandesi@linux.microsoft.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=saproj@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=v.v.mitrofanov@yadro.com \
    /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