]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mlxsw: Fix some IS_ERR() vs NULL bugs
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 22 Apr 2020 09:36:41 +0000 (12:36 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 14 May 2020 08:54:22 +0000 (10:54 +0200)
commit2b8b72daf074590874c0a6145cf2ac86af8cbe91
treef072a6a387a7ae51cbfea498b6d6c99f11578da5
parent872ff3c5a1726ecd9814a9db83acde15a544ef86
mlxsw: Fix some IS_ERR() vs NULL bugs

BugLink: https://bugs.launchpad.net/bugs/1877461
[ Upstream commit c391eb8366ae052d571bb2841f1ccb4d39f3ceb8 ]

The mlxsw_sp_acl_rulei_create() function is supposed to return an error
pointer from mlxsw_afa_block_create().  The problem is that these
functions both return NULL instead of error pointers.  Half the callers
expect NULL and half expect error pointers so it could lead to a NULL
dereference on failure.

This patch changes both of them to return error pointers and changes all
the callers which checked for NULL to check for IS_ERR() instead.

Fixes: 4cda7d8d7098 ("mlxsw: core: Introduce flexible actions support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ido Schimmel <idosch@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: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c