]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - net/rxrpc/sendmsg.c
rxrpc: Fix call ref leak
authorDavid Howells <dhowells@redhat.com>
Mon, 7 Oct 2019 09:58:28 +0000 (10:58 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 13 Nov 2019 23:47:34 +0000 (18:47 -0500)
commitd7c957e3d3e2a1b08d9fb3a9fe1591946ed5147c
tree9bdeb1889ff1c9865539174768a846f6759ea2fb
parent46d4f1384128280c44bb8d15d54eec35fe72088e
rxrpc: Fix call ref leak

BugLink: https://bugs.launchpad.net/bugs/1852492
commit c48fc11b69e95007109206311b0187a3090591f3 upstream.

When sendmsg() finds a call to continue on with, if the call is in an
inappropriate state, it doesn't release the ref it just got on that call
before returning an error.

This causes the following symptom to show up with kasan:

BUG: KASAN: use-after-free in rxrpc_send_keepalive+0x8a2/0x940
net/rxrpc/output.c:635
Read of size 8 at addr ffff888064219698 by task kworker/0:3/11077

where line 635 is:

whdr.epoch = htonl(peer->local->rxnet->epoch);

The local endpoint (which cannot be pinned by the call) has been released,
but not the peer (which is pinned by the call).

Fix this by releasing the call in the error path.

Fixes: 37411cad633f ("rxrpc: Fix potential NULL-pointer exception")
Reported-by: syzbot+d850c266e3df14da1d31@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/rxrpc/sendmsg.c