]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: core: Add missing rollback in error path
authorIdo Schimmel <idosch@mellanox.com>
Mon, 28 Nov 2016 17:01:25 +0000 (18:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Nov 2016 01:48:51 +0000 (20:48 -0500)
commit3df6d171cffbac3bfadd1329ed97b242751f9ce6
treed6e84fa7f256986cecafc3fa5a1c891ca195c72d
parent9c095b945e9d2983cbf958b5aee01bea319c82bd
mlxsw: core: Add missing rollback in error path

Without this rollback, the thermal zone is still registered during the
error path, whereas its private data is freed upon the destruction of
the underlying bus device due to the use of devm_kzalloc(). This results
in use after free.

Fix this by calling mlxsw_thermal_fini() from the appropriate place in
the error path.

Fixes: 8bd2987aab37 ("mlxsw: core: Implement thermal zone")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.c