lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wnu932qz.fsf@cloudflare.com>
Date:   Sun, 14 Mar 2021 21:21:40 +0100
From:   Jakub Sitnicki <jakub@...udflare.com>
To:     Alexander Lobakin <alobakin@...me>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andriin@...com>,
        Vladimir Oltean <vladimir.oltean@....com>,
        Davide Caratti <dcaratti@...hat.com>,
        Guillaume Nault <gnault@...hat.com>, wenxu <wenxu@...oud.cn>,
        Eran Ben Elisha <eranbe@...dia.com>,
        Matteo Croce <mcroce@...hat.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] flow_dissector: fix byteorder of dissected ICMP ID

On Fri, Mar 12, 2021 at 09:08 PM CET, Alexander Lobakin wrote:
> flow_dissector_key_icmp::id is of type u16 (CPU byteorder),
> ICMP header has its ID field in network byteorder obviously.
> Sparse says:
>
> net/core/flow_dissector.c:178:43: warning: restricted __be16 degrades to integer
>
> Convert ID value to CPU byteorder when storing it into
> flow_dissector_key_icmp.
>
> Fixes: 5dec597e5cd0 ("flow_dissector: extract more ICMP information")
> Signed-off-by: Alexander Lobakin <alobakin@...me>
> ---
>  net/core/flow_dissector.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 2ef2224b3bff..a96a4f5de0ce 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -176,7 +176,7 @@ void skb_flow_get_icmp_tci(const struct sk_buff *skb,
>  	 * avoid confusion with packets without such field
>  	 */
>  	if (icmp_has_id(ih->type))
> -		key_icmp->id = ih->un.echo.id ? : 1;
> +		key_icmp->id = ih->un.echo.id ? ntohs(ih->un.echo.id) : 1;
>  	else
>  		key_icmp->id = 0;
>  }

Smells like a breaking change for existing consumers of this value.

How about we change the type of flow_dissector_key_icmp{}.id to __be16
instead to make sparse happy?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ