On Wed, 2020-10-07 at 11:24 +0300, Leon Romanovsky wrote:
> On Wed, Oct 07, 2020 at 09:30:51AM +0200, Johannes Berg wrote:
> > On Wed, 2020-10-07 at 09:27 +0300, Leon Romanovsky wrote:
> > > This series and my guess that it comes from ff419afa4310 ("ethtool: trim 
> > > policy tables")
> > > generates the following KASAN out-of-bound error.
> > 
> > Interesting. I guess that is
> > 
> >     req_info->counts_only = tb[ETHTOOL_A_STRSET_COUNTS_ONLY];
> > 
> > which basically means that before you never actually *use* the
> > ETHTOOL_A_STRSET_COUNTS_ONLY flag, but of course it shouldn't be doing
> > this ...
> > 
> > Does this fix it?
> 
> Yes, it fixed KASAN, but it we got new failure after that.

Good.

I'm not very familiar with ethtool netlink tbh :)

> 11:07:51 player_id: 1 shell.py:62 [LinuxEthtoolAgent] DEBUG : running 
> command(/opt/mellanox/ethtool/sbin/ethtool --set-channels eth2 combined 3) 
> with pid: 13409
> 11:07:51 player_id: 1 protocol.py:605 [OpSetChannels] ERROR : RC:1, STDERR:
> netlink error: Unknown attribute type (offset 36)
> netlink error: Invalid argument

That's even stranger, since strict validation should've meant this was
always rejected? Hmm.

Oh, copy/paste error I guess, try this:

diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 8a85a4e6be9b..50d3c8896f91 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -830,8 +830,8 @@ static const struct genl_ops ethtool_genl_ops[] = {
                .cmd    = ETHTOOL_MSG_CHANNELS_SET,
                .flags  = GENL_UNS_ADMIN_PERM,
                .doit   = ethnl_set_channels,
-               .policy = ethnl_channels_get_policy,
-               .maxattr = ARRAY_SIZE(ethnl_channels_get_policy) - 1,
+               .policy = ethnl_channels_set_policy,
+               .maxattr = ARRAY_SIZE(ethnl_channels_set_policy) - 1,
        },
        {
                .cmd    = ETHTOOL_MSG_COALESCE_GET,

johannes

Reply via email to