linux-yocto/net/devlink
Michal Swiatkowski f8aaa38cfa devlink: fix xa_alloc_cyclic() error handling
[ Upstream commit f3b97b7d4bf316c3991e5634c9f4847c2df35478 ]

In case of returning 1 from xa_alloc_cyclic() (wrapping) ERR_PTR(1) will
be returned, which will cause IS_ERR() to be false. Which can lead to
dereference not allocated pointer (rel).

Fix it by checking if err is lower than zero.

This wasn't found in real usecase, only noticed. Credit to Pierre.

Fixes: c137743bce ("devlink: introduce object and nested devlink relationship infra")
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-28 22:03:27 +01:00
..
core.c devlink: fix xa_alloc_cyclic() error handling 2025-03-28 22:03:27 +01:00
dev.c netlink: add nlmsg_consume() and use it in devlink compat 2024-04-06 18:20:14 +01:00
devl_internal.h devlink: extend multicast filtering by port index 2023-12-19 15:31:40 +01:00
dpipe.c devlink: Constify the 'table_ops' parameter of devl_dpipe_table_register() 2024-06-05 10:24:57 +01:00
health.c devlink: extend multicast filtering by port index 2023-12-19 15:31:40 +01:00
linecard.c devlink: introduce a helper for netlink multicast send 2023-12-19 15:31:40 +01:00
Makefile devlink: move devlink_notify_register/unregister() to dev.c 2023-08-28 08:02:24 -07:00
netlink_gen.c devlink: Fix length of eswitch inline-mode 2024-03-11 13:13:53 -07:00
netlink_gen.h devlink: add a command to set notification filter and use it for multicasts 2023-12-19 15:31:40 +01:00
netlink.c devlink: Fix devlink parallel commands processing 2024-03-13 08:31:40 +00:00
param.c devlink: extend devlink_param *set pointer 2024-04-22 13:05:19 -07:00
port.c devlink: Support setting max_io_eqs 2024-04-08 14:10:45 +01:00
rate.c devlink: introduce a helper for netlink multicast send 2023-12-19 15:31:40 +01:00
region.c devlink: introduce a helper for netlink multicast send 2023-12-19 15:31:40 +01:00
resource.c devlink: rename netlink callback to be aligned with the generated ones 2023-10-23 16:12:47 -07:00
sb.c devlink: rename netlink callback to be aligned with the generated ones 2023-10-23 16:12:47 -07:00
trap.c devlink: introduce a helper for netlink multicast send 2023-12-19 15:31:40 +01:00