[PATCH v1 31/34] j1939: main: unregister priv form ndev on last socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we are using proper kref, there is no way back on last socket.
We should unregister old priv and allow to destroy it. The new one
will be register as soon as socket will need it again.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index 315166ef3eb1..ac026a8408c3 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -135,8 +135,6 @@ static void __j1939_priv_release(struct kref *kref)
 	struct j1939_priv *priv = container_of(kref, struct j1939_priv, kref);
 	struct net_device *ndev = priv->ndev;
 
-	/* unlink from netdev */
-	j1939_priv_set(ndev, NULL);
 	netdev_dbg(priv->ndev, "__j1939_priv_release: 0x%p\n", priv);
 
 	dev_put(ndev);
@@ -186,6 +184,7 @@ static void __j1939_rx_release(struct kref *kref)
 
 	j1939_can_rx_unregister(priv);
 	j1939_ecu_unmap_all(priv);
+	j1939_priv_set(priv->ndev, NULL);
 }
 
 /* get pointer to priv without increasing ref counter */
-- 
2.20.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux