Revert "Revert "can: dev: Move device back to init netns on owning netns delete""

This reverts commit 4ca012d8ea as the kabi
can be updated at this point in time.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5f2d693199b3bf04eb00c0380c4b426c1749f62e
This commit is contained in:
Greg Kroah-Hartman
2021-04-05 11:18:09 +02:00
committed by Todd Kjos
parent fa5fc9f474
commit 421e0ec416
3 changed files with 4 additions and 1 deletions

View File

@@ -1255,6 +1255,7 @@ static void can_dellink(struct net_device *dev, struct list_head *head)
static struct rtnl_link_ops can_link_ops __read_mostly = {
.kind = "can",
.netns_refund = true,
.maxtype = IFLA_CAN_MAX,
.policy = can_policy,
.setup = can_setup,

View File

@@ -33,6 +33,7 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
*
* @list: Used internally
* @kind: Identifier
* @netns_refund: Physical device, move to init_net on netns exit
* @maxtype: Highest device specific netlink attribute number
* @policy: Netlink policy for device specific attribute validation
* @validate: Optional validation function for netlink/changelink parameters
@@ -64,6 +65,7 @@ struct rtnl_link_ops {
size_t priv_size;
void (*setup)(struct net_device *dev);
bool netns_refund;
unsigned int maxtype;
const struct nla_policy *policy;
int (*validate)(struct nlattr *tb[],

View File

@@ -11106,7 +11106,7 @@ static void __net_exit default_device_exit(struct net *net)
continue;
/* Leave virtual devices for the generic cleanup */
if (dev->rtnl_link_ops)
if (dev->rtnl_link_ops && !dev->rtnl_link_ops->netns_refund)
continue;
/* Push remaining network devices to init_net */