netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net] net: core: devlink: use right genl user_ptr when handling port param get/set
@ 2021-01-19  8:53 Vadym Kochan
  2021-01-19 19:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Vadym Kochan @ 2021-01-19  8:53 UTC (permalink / raw)
  To: Jiri Pirko, David S. Miller, Jakub Kicinski, netdev
  Cc: Oleksandr Mazur, Parav Pandit, Vadym Kochan

From: Oleksandr Mazur <oleksandr.mazur@plvision.eu>

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>
---
v2:
    1) Use correct "Fixes" commit.

 net/core/devlink.c | 4 ++--
 1 file 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 @@ static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg,
 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,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 net] net: core: devlink: use right genl user_ptr when handling port param get/set
  2021-01-19  8:53 [PATCH v2 net] net: core: devlink: use right genl user_ptr when handling port param get/set Vadym Kochan
@ 2021-01-19 19:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-19 19:50 UTC (permalink / raw)
  To: Vadym Kochan; +Cc: jiri, davem, kuba, netdev, oleksandr.mazur, parav

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 19 Jan 2021 10:53:33 +0200 you wrote:
> From: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
> 
> 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;
> 
> [...]

Here is the summary with links:
  - [v2,net] net: core: devlink: use right genl user_ptr when handling port param get/set
    https://git.kernel.org/netdev/net/c/7e238de8283a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-19 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19  8:53 [PATCH v2 net] net: core: devlink: use right genl user_ptr when handling port param get/set Vadym Kochan
2021-01-19 19:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).