]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: core: Use devm_kzalloc to allocate mlxsw_hwmon structure
authorJiri Pirko <jiri@mellanox.com>
Tue, 22 Dec 2015 08:43:07 +0000 (09:43 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Dec 2015 21:25:09 +0000 (16:25 -0500)
commit231b39f55bebdd3d286afe6f33b206b4f633c184
treedf31e4d939de5cc4c2817c72f7235a497d720d6f
parenta3a8bd42b0bb93580b5dd3eb6759c79ee0a0f107
mlxsw: core: Use devm_kzalloc to allocate mlxsw_hwmon structure

KASan reported use-after-free for the hwmon structure. So fix this by
using devm_kzalloc and let the core take care about freeing the memory
during device dettach.

Reported-by: Ido Schimmel <idosch@mellanox.com>
Fixes: 1fb88d425 ("mlxsw: core: Implement temperature hwmon interface")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core.h
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c