Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- net/can/j1939/socket.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index 49c2d3601ca0..a94e36d54c2d 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -392,6 +392,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) /* drop old references */ priv = j1939_priv_get_by_ndev(ndev); j1939_local_ecu_put(priv, jsk->addr.src_name, jsk->addr.sa); + j1939_priv_put(priv); } else { if (ndev->type != ARPHRD_CAN) { ret = -ENODEV; @@ -405,7 +406,6 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) } jsk->ifindex = addr->can_ifindex; - j1939_priv_get(priv); } /* set default transmit pgn */ @@ -418,7 +418,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_priv_put; + goto out_dev_put; } if (!(jsk->state & J1939_SOCK_BOUND)) { @@ -429,9 +429,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) jsk->state |= J1939_SOCK_BOUND; } - out_priv_put: /* fallthrough */ - j1939_priv_put(priv); - out_dev_put: + out_dev_put: /* fallthrough */ dev_put(ndev); out_release_sock: release_sock(sock->sk); -- 2.20.1