All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int
@ 2022-09-13 23:07 ` Nathan Huckleberry
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Huckleberry @ 2022-09-13 23:07 UTC (permalink / raw)
  Cc: Nathan Huckleberry, Dan Carpenter, llvm, Pravin B Shelar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Nathan Chancellor, Nick Desaulniers, Tom Rix, netdev, dev,
	linux-kernel

All usages of the vport_ops struct have the .send field set to
dev_queue_xmit or internal_dev_recv.  Since most usages are set to
dev_queue_xmit, the function hook should match the signature of
dev_queue_xmit.

The only call to vport_ops->send() is in net/openvswitch/vport.c and it
throws away the return value.

This mismatched return type breaks forward edge kCFI since the underlying
function definition does not match the function hook definition.

Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/1703
Cc: llvm@lists.linux.dev
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 net/openvswitch/vport-internal_dev.c | 2 +-
 net/openvswitch/vport.h              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 35f42c9821c2..74c88a6baa43 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -190,7 +190,7 @@ static void internal_dev_destroy(struct vport *vport)
 	rtnl_unlock();
 }
 
-static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
+static int internal_dev_recv(struct sk_buff *skb)
 {
 	struct net_device *netdev = skb->dev;
 
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 7d276f60c000..6ff45e8a0868 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -132,7 +132,7 @@ struct vport_ops {
 	int (*set_options)(struct vport *, struct nlattr *);
 	int (*get_options)(const struct vport *, struct sk_buff *);
 
-	netdev_tx_t (*send) (struct sk_buff *skb);
+	int (*send)(struct sk_buff *skb);
 	struct module *owner;
 	struct list_head list;
 };
-- 
2.37.2.789.g6183377224-goog


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

* [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int
@ 2022-09-13 23:07 ` Nathan Huckleberry
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Huckleberry @ 2022-09-13 23:07 UTC (permalink / raw)
  Cc: Nathan Huckleberry, Dan Carpenter, llvm, Pravin B Shelar,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Nathan Chancellor, Nick Desaulniers, Tom Rix, netdev, dev,
	linux-kernel

All usages of the vport_ops struct have the .send field set to
dev_queue_xmit or internal_dev_recv.  Since most usages are set to
dev_queue_xmit, the function hook should match the signature of
dev_queue_xmit.

The only call to vport_ops->send() is in net/openvswitch/vport.c and it
throws away the return value.

This mismatched return type breaks forward edge kCFI since the underlying
function definition does not match the function hook definition.

Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/1703
Cc: llvm@lists.linux.dev
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 net/openvswitch/vport-internal_dev.c | 2 +-
 net/openvswitch/vport.h              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 35f42c9821c2..74c88a6baa43 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -190,7 +190,7 @@ static void internal_dev_destroy(struct vport *vport)
 	rtnl_unlock();
 }
 
-static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
+static int internal_dev_recv(struct sk_buff *skb)
 {
 	struct net_device *netdev = skb->dev;
 
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 7d276f60c000..6ff45e8a0868 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -132,7 +132,7 @@ struct vport_ops {
 	int (*set_options)(struct vport *, struct nlattr *);
 	int (*get_options)(const struct vport *, struct sk_buff *);
 
-	netdev_tx_t (*send) (struct sk_buff *skb);
+	int (*send)(struct sk_buff *skb);
 	struct module *owner;
 	struct list_head list;
 };
-- 
2.37.2.789.g6183377224-goog


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

* Re: [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int
  2022-09-13 23:07 ` Nathan Huckleberry
  (?)
@ 2022-09-13 23:26 ` Nathan Chancellor
  -1 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2022-09-13 23:26 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Dan Carpenter, llvm, Pravin B Shelar, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nick Desaulniers,
	Tom Rix, netdev, dev, linux-kernel

On Tue, Sep 13, 2022 at 04:07:38PM -0700, Nathan Huckleberry wrote:
> All usages of the vport_ops struct have the .send field set to
> dev_queue_xmit or internal_dev_recv.  Since most usages are set to
> dev_queue_xmit, the function hook should match the signature of
> dev_queue_xmit.
> 
> The only call to vport_ops->send() is in net/openvswitch/vport.c and it
> throws away the return value.
> 
> This mismatched return type breaks forward edge kCFI since the underlying
> function definition does not match the function hook definition.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Cc: llvm@lists.linux.dev
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  net/openvswitch/vport-internal_dev.c | 2 +-
>  net/openvswitch/vport.h              | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
> index 35f42c9821c2..74c88a6baa43 100644
> --- a/net/openvswitch/vport-internal_dev.c
> +++ b/net/openvswitch/vport-internal_dev.c
> @@ -190,7 +190,7 @@ static void internal_dev_destroy(struct vport *vport)
>  	rtnl_unlock();
>  }
>  
> -static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
> +static int internal_dev_recv(struct sk_buff *skb)
>  {
>  	struct net_device *netdev = skb->dev;
>  
> diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
> index 7d276f60c000..6ff45e8a0868 100644
> --- a/net/openvswitch/vport.h
> +++ b/net/openvswitch/vport.h
> @@ -132,7 +132,7 @@ struct vport_ops {
>  	int (*set_options)(struct vport *, struct nlattr *);
>  	int (*get_options)(const struct vport *, struct sk_buff *);
>  
> -	netdev_tx_t (*send) (struct sk_buff *skb);
> +	int (*send)(struct sk_buff *skb);
>  	struct module *owner;
>  	struct list_head list;
>  };
> -- 
> 2.37.2.789.g6183377224-goog
> 

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

* Re: [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int
  2022-09-13 23:07 ` Nathan Huckleberry
  (?)
  (?)
@ 2022-09-19 13:20 ` Eelco Chaudron
  -1 siblings, 0 replies; 6+ messages in thread
From: Eelco Chaudron @ 2022-09-19 13:20 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Dan Carpenter, llvm, Pravin B Shelar, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, netdev, dev, linux-kernel



On 14 Sep 2022, at 1:07, Nathan Huckleberry wrote:

> All usages of the vport_ops struct have the .send field set to
> dev_queue_xmit or internal_dev_recv.  Since most usages are set to
> dev_queue_xmit, the function hook should match the signature of
> dev_queue_xmit.
>
> The only call to vport_ops->send() is in net/openvswitch/vport.c and it
> throws away the return value.
>
> This mismatched return type breaks forward edge kCFI since the underlying
> function definition does not match the function hook definition.
>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Cc: llvm@lists.linux.dev
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

The changes look good to me.

Acked-by: Eelco Chaudron <echaudro@redhat.com>


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

* Re: [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int
  2022-09-13 23:07 ` Nathan Huckleberry
@ 2022-09-20  1:40   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-20  1:40 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: , error27, llvm, pshelar, davem, edumazet, kuba, pabeni, nathan,
	ndesaulniers, trix, netdev, dev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 13 Sep 2022 16:07:38 -0700 you wrote:
> All usages of the vport_ops struct have the .send field set to
> dev_queue_xmit or internal_dev_recv.  Since most usages are set to
> dev_queue_xmit, the function hook should match the signature of
> dev_queue_xmit.
> 
> The only call to vport_ops->send() is in net/openvswitch/vport.c and it
> throws away the return value.
> 
> [...]

Here is the summary with links:
  - openvswitch: Change the return type for vport_ops.send function hook to int
    https://git.kernel.org/netdev/net-next/c/8bb7c4f8c927

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] 6+ messages in thread

* Re: [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int
@ 2022-09-20  1:40   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-20  1:40 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: error27, llvm, pshelar, davem, edumazet, kuba, pabeni, nathan,
	ndesaulniers, trix, netdev, dev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 13 Sep 2022 16:07:38 -0700 you wrote:
> All usages of the vport_ops struct have the .send field set to
> dev_queue_xmit or internal_dev_recv.  Since most usages are set to
> dev_queue_xmit, the function hook should match the signature of
> dev_queue_xmit.
> 
> The only call to vport_ops->send() is in net/openvswitch/vport.c and it
> throws away the return value.
> 
> [...]

Here is the summary with links:
  - openvswitch: Change the return type for vport_ops.send function hook to int
    https://git.kernel.org/netdev/net-next/c/8bb7c4f8c927

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] 6+ messages in thread

end of thread, other threads:[~2022-09-20  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 23:07 [PATCH] openvswitch: Change the return type for vport_ops.send function hook to int Nathan Huckleberry
2022-09-13 23:07 ` Nathan Huckleberry
2022-09-13 23:26 ` Nathan Chancellor
2022-09-19 13:20 ` Eelco Chaudron
2022-09-20  1:40 ` patchwork-bot+netdevbpf
2022-09-20  1:40   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.