• Petr Machata's avatar
    net: DCB: Validate DCB_ATTR_DCB_BUFFER argument · 297e77e5
    Petr Machata authored
    The parameter passed via DCB_ATTR_DCB_BUFFER is a struct dcbnl_buffer. The
    field prio2buffer is an array of IEEE_8021Q_MAX_PRIORITIES bytes, where
    each value is a number of a buffer to direct that priority's traffic to.
    That value is however never validated to lie within the bounds set by
    DCBX_MAX_BUFFERS. The only driver that currently implements the callback is
    mlx5 (maintainers CCd), and that does not do any validation either, in
    particual allowing incorrect configuration if the prio2buffer value does
    not fit into 4 bits.
    
    Instead of offloading the need to validate the buffer index to drivers, do
    it right there in core, and bounce the request if the value is too large.
    
    CC: Parav Pandit <parav@nvidia.com>
    CC: Saeed Mahameed <saeedm@nvidia.com>
    Fixes: e549f6f9 ("net/dcb: Add dcbnl buffer attribute")
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    297e77e5
dcbnl.c 52.2 KB