]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mlxsw: spectrum_mr: Fix list iteration in error path
authorIdo Schimmel <idosch@mellanox.com>
Thu, 26 Mar 2020 14:17:33 +0000 (16:17 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 7 Apr 2020 08:53:09 +0000 (10:53 +0200)
commit9c522ce8e7e90e0734c97f927d95ae7543699d0a
treeec44a9b67a5cf9f732045a47bcd0397579a1301b
parentecc241f1068d5106e04955d0b58fa5a2aaa7df0b
mlxsw: spectrum_mr: Fix list iteration in error path

BugLink: https://bugs.launchpad.net/bugs/1870604
[ Upstream commit f6bf1bafdc2152bb22aff3a4e947f2441a1d49e2 ]

list_for_each_entry_from_reverse() iterates backwards over the list from
the current position, but in the error path we should start from the
previous position.

Fix this by using list_for_each_entry_continue_reverse() instead.

This suppresses the following error from coccinelle:

drivers/net/ethernet/mellanox/mlxsw//spectrum_mr.c:655:34-38: ERROR:
invalid reference to the index variable of the iterator on line 636

Fixes: c011ec1bbfd6 ("mlxsw: spectrum: Add the multicast routing offloading logic")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c