]> git.karo-electronics.de Git - linux-beck.git/commitdiff
driver: ipvlan: Free ipvl_port directly with kfree instead of kfree_rcu
authorGao Feng <fgao@ikuai8.com>
Wed, 7 Dec 2016 00:44:47 +0000 (08:44 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Dec 2016 18:21:21 +0000 (13:21 -0500)
There are two functions which would free the ipvl_port now. The first
is ipvlan_port_create. It frees the ipvl_port in the error handler,
so it could kfree it directly. The second is ipvlan_port_destroy. It
invokes netdev_rx_handler_unregister which enforces one grace period
by synchronize_net firstly, so it also could kfree the ipvl_port
directly and safely.

So it is unnecessary to use kfree_rcu to free ipvl_port.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipvlan/ipvlan.h
drivers/net/ipvlan/ipvlan_main.c

index 05a62d2216c54651f6158c35d446d2e395b38dc3..031093e1c25f55244e6bdfde4ebeb65c0f2f10c1 100644 (file)
@@ -97,7 +97,6 @@ struct ipvl_port {
        struct work_struct      wq;
        struct sk_buff_head     backlog;
        int                     count;
-       struct rcu_head         rcu;
 };
 
 static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d)
index 5430460167b5e8945d29a3febdd324461bf5af5c..ffe8994e64fc1791ef07d80ad2340bc82d541bba 100644 (file)
@@ -128,7 +128,7 @@ static int ipvlan_port_create(struct net_device *dev)
        return 0;
 
 err:
-       kfree_rcu(port, rcu);
+       kfree(port);
        return err;
 }
 
@@ -145,7 +145,7 @@ static void ipvlan_port_destroy(struct net_device *dev)
        netdev_rx_handler_unregister(dev);
        cancel_work_sync(&port->wq);
        __skb_queue_purge(&port->backlog);
-       kfree_rcu(port, rcu);
+       kfree(port);
 }
 
 #define IPVLAN_FEATURES \