... this also fixes the cleanup and reference counting in j1939_sk_release() if j1939_local_ecu_get() fails. Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- net/can/j1939/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index c78b41b55d21..813aab534e91 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -409,6 +409,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_jsk_del(priv, jsk); j1939_local_ecu_put(priv, jsk->addr.src_name, jsk->addr.sa); j1939_priv_put(priv); } else { @@ -439,8 +440,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) goto out_dev_put; } - if (!(jsk->state & J1939_SOCK_BOUND)) - j1939_jsk_add(priv, jsk); + j1939_jsk_add(priv, jsk); out_dev_put: /* fallthrough */ dev_put(ndev); -- 2.20.1