diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-03-24 13:14:37 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-24 21:55:31 +0300 |
commit | b8f975545cdbcc316cf20e827e7966d4410b5c5a (patch) | |
tree | b53eda2346f5ff0bac3b5810a3321d8d6ba27ab3 /include/net/devlink.h | |
parent | 2b239e7090b89d1e2b73b48300686221ca948637 (diff) | |
download | linux-b8f975545cdbcc316cf20e827e7966d4410b5c5a.tar.xz |
net: devlink: add port type spinlock
Add spinlock to protect port type and type_dev pointer consistency.
Without that, userspace may see inconsistent type and type_dev
combinations.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
v1->v2:
- rebased
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/devlink.h')
-rw-r--r-- | include/net/devlink.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h index 63de99e09f04..cb9b060033e1 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -16,6 +16,7 @@ #include <linux/gfp.h> #include <linux/list.h> #include <linux/netdevice.h> +#include <linux/spinlock.h> #include <net/net_namespace.h> #include <uapi/linux/devlink.h> @@ -53,6 +54,9 @@ struct devlink_port { struct devlink *devlink; unsigned index; bool registered; + spinlock_t type_lock; /* Protects type and type_dev + * pointer consistency. + */ enum devlink_port_type type; enum devlink_port_type desired_type; void *type_dev; |