Skip to content

Commit

Permalink
openvswitch: Change the return type for vport_ops.send function hook …
Browse files Browse the repository at this point in the history
…to int

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>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Link: https://lore.kernel.org/r/20220913230739.228313-1-nhuck@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Nathan Huckleberry authored and Jakub Kicinski committed Sep 20, 2022
1 parent 73c99e2 commit 8bb7c4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/openvswitch/vport-internal_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion net/openvswitch/vport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 8bb7c4f

Please sign in to comment.