mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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>
This commit is contained in:
parent
2b239e7090
commit
b8f975545c
2 changed files with 17 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue