Commit 38325036 authored by Tom Herbert's avatar Tom Herbert Committed by Greg Kroah-Hartman

kcm: Call strp_stop before strp_done in kcm_attach

commit dff8baa2 upstream.

In kcm_attach strp_done is called when sk_user_data is already
set to fail the attach. strp_done needs the strp to be stopped and
warns if it isn't. Call strp_stop in this case to eliminate the
warning message.

Reported-by: syzbot+88dfb55e4c8b770d86e3@syzkaller.appspotmail.com
Fixes: e5571240 ("kcm: Check if sk_user_data already set in kcm_attach"
Signed-off-by: default avatarTom Herbert <tom@quantonium.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1899f679
...@@ -1424,6 +1424,7 @@ static int kcm_attach(struct socket *sock, struct socket *csock, ...@@ -1424,6 +1424,7 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
*/ */
if (csk->sk_user_data) { if (csk->sk_user_data) {
write_unlock_bh(&csk->sk_callback_lock); write_unlock_bh(&csk->sk_callback_lock);
strp_stop(&psock->strp);
strp_done(&psock->strp); strp_done(&psock->strp);
kmem_cache_free(kcm_psockp, psock); kmem_cache_free(kcm_psockp, psock);
err = -EALREADY; err = -EALREADY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment