]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
nfp: flower: Fix a potential leak in nfp_tunnel_add_shared_mac()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 18 Feb 2022 13:15:35 +0000 (14:15 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 7 Mar 2022 10:45:59 +0000 (11:45 +0100)
commit86362540c859cccf8b26cd5cea6868f014313534
tree894a4311cc0a3b5e3ba5bb600243b3fe22971f4f
parent5c10378f1ec620cea99e88b466bf295ed77ea644
nfp: flower: Fix a potential leak in nfp_tunnel_add_shared_mac()

BugLink: https://bugs.launchpad.net/bugs/1963891
commit 3a14d0888eb4b0045884126acc69abfb7b87814d upstream.

ida_simple_get() returns an id between min (0) and max (NFP_MAX_MAC_INDEX)
inclusive.
So NFP_MAX_MAC_INDEX (0xff) is a valid id.

In order for the error handling path to work correctly, the 'invalid'
value for 'ida_idx' should not be in the 0..NFP_MAX_MAC_INDEX range,
inclusive.

So set it to -1.

Fixes: 20cce8865098 ("nfp: flower: enable MAC address sharing for offloadable devs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20220218131535.100258-1-simon.horman@corigine.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c