# Re: \[PATCH net-next v2 04/10\] devlink: allow to use devlink index as a command handle

- From: Jakub Kicinski \<kuba@kernel.org\>
- Date: 2026-02-28 22:48:48 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/02/8535547
- Thread: https://ratatoskr.run/netdev/2026/02/8535523/t.md

```text
On Wed, 25 Feb 2026 14:34:16 +0100 Jiri Pirko wrote:
> +	if (attrs[DEVLINK_ATTR_INDEX]) {
> +		index = nla_get_uint(attrs[DEVLINK_ATTR_INDEX]);
> +		devlink = devlinks_xa_lookup_get(net, index);
> +		if (!devlink)
> +			return ERR_PTR(-ENODEV);
> +		goto found;
> +	}
> +
>  	if (!attrs[DEVLINK_ATTR_BUS_NAME] || !attrs[DEVLINK_ATTR_DEV_NAME])
>  		return ERR_PTR(-EINVAL);

If both INDEX and BUS_NAME + DEV_NAME are provided we should check
that they point to the same device? Or reject user space passing both?
```
