diff options
author | Oleksandr Mazur <oleksandr.mazur@plvision.eu> | 2021-01-19 11:53:33 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-19 22:45:41 +0300 |
commit | 7e238de8283acd32c26c2bc2a50672d0ea862ff7 (patch) | |
tree | 0b9ee64e9426187e1d3d746ca9ea999e04a87290 | |
parent | 9d9b1ee0b2d1c9e02b2338c4a4b0a062d2d3edac (diff) | |
download | linux-7e238de8283acd32c26c2bc2a50672d0ea862ff7.tar.xz |
net: core: devlink: use right genl user_ptr when handling port param get/set
Fix incorrect user_ptr dereferencing when handling port param get/set:
idx [0] stores the 'struct devlink' pointer;
idx [1] stores the 'struct devlink_port' pointer;
Fixes: 637989b5d77e ("devlink: Always use user_ptr[0] for devlink and simplify post_doit")
CC: Parav Pandit <parav@mellanox.com>
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu>
Link: https://lore.kernel.org/r/20210119085333.16833-1-vadym.kochan@plvision.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | net/core/devlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index ee828e4b1007..738d4344d679 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4146,7 +4146,7 @@ out: static int devlink_nl_cmd_port_param_get_doit(struct sk_buff *skb, struct genl_info *info) { - struct devlink_port *devlink_port = info->user_ptr[0]; + struct devlink_port *devlink_port = info->user_ptr[1]; struct devlink_param_item *param_item; struct sk_buff *msg; int err; @@ -4175,7 +4175,7 @@ static int devlink_nl_cmd_port_param_get_doit(struct sk_buff *skb, static int devlink_nl_cmd_port_param_set_doit(struct sk_buff *skb, struct genl_info *info) { - struct devlink_port *devlink_port = info->user_ptr[0]; + struct devlink_port *devlink_port = info->user_ptr[1]; return __devlink_nl_cmd_param_set_doit(devlink_port->devlink, devlink_port->index, |