[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0880af20-f0a2-bc19-6b1d-0e42a7937184@gmail.com>
Date: Thu, 5 Apr 2018 14:55:58 -0600
From: David Ahern <dsahern@...il.com>
To: Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org
Cc: davem@...emloft.net, idosch@...lanox.com,
jakub.kicinski@...ronome.com, mlxsw@...lanox.com
Subject: Re: [patch net] devlink: convert occ_get op to separate registration
On 4/5/18 2:13 PM, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@...lanox.com>
>
> This resolves race during initialization where the resources with
> ops are registered before driver and the structures used by occ_get
> op is initialized. So keep occ_get callbacks registered only when
> all structs are initialized.
>
> The example flows, as it is in mlxsw:
> 1) driver load/asic probe:
> mlxsw_core
> -> mlxsw_sp_resources_register
> -> mlxsw_sp_kvdl_resources_register
> -> devlink_resource_register IDX
> mlxsw_spectrum
> -> mlxsw_sp_kvdl_init
> -> mlxsw_sp_kvdl_parts_init
> -> mlxsw_sp_kvdl_part_init
> -> devlink_resource_size_get IDX (to get the current setup
> size from devlink)
> -> devlink_resource_occ_get_register IDX (register current
> occupancy getter)
> 2) reload triggered by devlink command:
> -> mlxsw_devlink_core_bus_device_reload
> -> mlxsw_sp_fini
> -> mlxsw_sp_kvdl_fini
> -> devlink_resource_occ_get_unregister IDX
> (struct mlxsw_sp *mlxsw_sp is freed at this point, call to occ get
> which is using mlxsw_sp would cause use-after free)
> -> mlxsw_sp_init
> -> mlxsw_sp_kvdl_init
> -> mlxsw_sp_kvdl_parts_init
> -> mlxsw_sp_kvdl_part_init
> -> devlink_resource_size_get IDX (to get the current setup
> size from devlink)
> -> devlink_resource_occ_get_register IDX (register current
> occupancy getter)
>
> Fixes: d9f9b9a4d05f ("devlink: Add support for resource abstraction")
> Signed-off-by: Jiri Pirko <jiri@...lanox.com>
> ---
Why won't something like the attached work as opposed to playing
register / unregister games?
View attachment "mlxsw-reload.patch" of type "text/plain" (4748 bytes)
Powered by blists - more mailing lists