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]
Date:   Thu, 20 Jan 2022 15:43:14 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Moshe Tal <moshet@...dia.com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Ido Schimmel <idosch@...dia.com>, netdev@...r.kernel.org,
        Amit Cohen <amcohen@...dia.com>, Jiri Pirko <jiri@...dia.com>,
        Petr Machata <petrm@...dia.com>, Gal Pressman <gal@...dia.com>,
        Tariq Toukan <tariqt@...dia.com>
Subject: Re: [PATCH net] ethtool: Fix link extended state for big endian

On Thu, Jan 20, 2022 at 11:55:50AM +0200, Moshe Tal wrote:
> The link extended sub-states are assigned as enum that is an integer
> size but read from a union as u8, this is working for small values on
> little endian systems but for big endian this always give 0. Fix the
> variable in the union to match the enum size.
> 
> Fixes: ecc31c60240b ("ethtool: Add link extended state")
> Signed-off-by: Moshe Tal <moshet@...dia.com>
> Reviewed-by: Ido Schimmel <idosch@...dia.com>
> Tested-by: Ido Schimmel <idosch@...dia.com>
> Reviewed-by: Gal Pressman <gal@...dia.com>
> Reviewed-by: Amit Cohen <amcohen@...dia.com>
> ---
>  include/linux/ethtool.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index a26f37a27167..11efc45de66a 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -111,7 +111,7 @@ struct ethtool_link_ext_state_info {
>  		enum ethtool_link_ext_substate_bad_signal_integrity bad_signal_integrity;
>  		enum ethtool_link_ext_substate_cable_issue cable_issue;
>  		enum ethtool_link_ext_substate_module module;
> -		u8 __link_ext_substate;
> +		u32 __link_ext_substate;

Not my area of expertise, but:

static int linkstate_reply_size(const struct ethnl_req_info *req_base,
                                const struct ethnl_reply_data *reply_base)
{
        struct linkstate_reply_data *data = LINKSTATE_REPDATA(reply_base);
        int len;

       if (data->ethtool_link_ext_state_info.__link_ext_substate)
                len += nla_total_size(sizeof(u8)); /* LINKSTATE_EXT_SUBSTATE */

and

static int linkstate_fill_reply(struct sk_buff *skb,
                                const struct ethnl_req_info *req_base,
                                const struct ethnl_reply_data *reply_base)
{

		if (data->ethtool_link_ext_state_info.__link_ext_substate &&
                    nla_put_u8(skb, ETHTOOL_A_LINKSTATE_EXT_SUBSTATE,
                               data->ethtool_link_ext_state_info.__link_ext_substate))
                        return -EMSGSIZE;

This seems to suggest it is a u8, not a u32.

I guess i don't understand something here...

  Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ