[PATCH v1 16/34] j1939: socket: fix refcounting on j1939_sk_bind() error

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

 



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

diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 89174b517b28..12db6a32efee 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -416,7 +416,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 	ret = j1939_local_ecu_get(priv, jsk->addr.src_name, jsk->addr.sa);
 	if (ret) {
 		j1939_netdev_stop(ndev);
-		goto out_dev_put;
+		goto out_priv_put;
 	}
 
 	if (!(jsk->state & J1939_SOCK_BOUND)) {
@@ -426,9 +426,10 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 
 		jsk->state |= J1939_SOCK_BOUND;
 	}
-	j1939_priv_put(priv);
 
- out_dev_put:	/* fallthrough */
+ out_priv_put:	/* fallthrough */
+	j1939_priv_put(priv);
+ out_dev_put:
 	dev_put(ndev);
  out_release_sock:
 	release_sock(sock->sk);
-- 
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