[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_fgrvLNUPiTBOddrUcGFep-XkO4wbp01UXPybg0vXPVzA@mail.gmail.com>
Date: Wed, 23 Feb 2022 14:08:06 +0800
From: Xin Long <lucien.xin@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: network dev <netdev@...r.kernel.org>, davem <davem@...emloft.net>,
Vasiliy Kulikov <segoon@...nwall.com>
Subject: Re: [PATCH net] ping: fix the dif and sdif check in ping_lookup
On Thu, Feb 17, 2022 at 11:57 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Wed, 16 Feb 2022 00:20:52 -0500 Xin Long wrote:
> > if (skb->protocol == htons(ETH_P_IP)) {
> > + dif = inet_iif(skb);
> > + sdif = inet_sdif(skb);
> > pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n",
> > (int)ident, &ip_hdr(skb)->daddr, dif);
> > #if IS_ENABLED(CONFIG_IPV6)
> > } else if (skb->protocol == htons(ETH_P_IPV6)) {
> > + dif = inet6_iif(skb);
> > + sdif = inet6_sdif(skb);
> > pr_debug("try to find: num = %d, daddr = %pI6c, dif = %d\n",
> > (int)ident, &ipv6_hdr(skb)->daddr, dif);
> > #endif
> > + } else {
> > + pr_err("ping: protocol(%x) is not supported\n", ntohs(skb->protocol));
> > + return NULL;
> > }
>
> Are you sure this is not reachable from some networking path allowing
> attacker (or local user) to DoS the kernel logs?
Hi, Jakub, sorry for late.
I actually didn't see how a skb with protocol != IP/IPV6 could reach here.
ping_err() is using "BUG()" for this kind of case.
I added this 'else' branch mostly to avoid the possible compiling
warning for "Use of uninitialized value dif/sdif".
Thanks.
Powered by blists - more mailing lists