From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
syzbot+d850c266e3df14da1d31@syzkaller.appspotmail.com,
Sasha Levin <sashal@kernel.org>,
linux-afs@lists.infradead.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 13/25] rxrpc: Fix call ref leak
Date: Fri, 25 Oct 2019 09:57:01 -0400 [thread overview]
Message-ID: <20191025135715.25468-13-sashal@kernel.org> (raw)
In-Reply-To: <20191025135715.25468-1-sashal@kernel.org>
From: David Howells <dhowells@redhat.com>
[ Upstream commit c48fc11b69e95007109206311b0187a3090591f3 ]
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: Sasha Levin <sashal@kernel.org>
---
net/rxrpc/sendmsg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 016e293681b8c..a980b49d7a4f8 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -586,6 +586,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
case RXRPC_CALL_SERVER_PREALLOC:
case RXRPC_CALL_SERVER_SECURING:
case RXRPC_CALL_SERVER_ACCEPTING:
+ rxrpc_put_call(call, rxrpc_call_put);
ret = -EBUSY;
goto error_release_sock;
default:
--
2.20.1
next prev parent reply other threads:[~2019-10-25 13:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191025135715.25468-1-sashal@kernel.org>
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 12/25] sch_netem: fix rcu splat in netem_enqueue() Sasha Levin
2019-10-25 13:57 ` Sasha Levin [this message]
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 14/25] llc: fix sk_buff leak in llc_sap_state_process() Sasha Levin
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 15/25] llc: fix sk_buff leak in llc_conn_service() Sasha Levin
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 16/25] NFC: pn533: fix use-after-free and memleaks Sasha Levin
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 17/25] bonding: fix potential NULL deref in bond_update_slave_arr Sasha Levin
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 18/25] net: usb: sr9800: fix uninitialized local variable Sasha Levin
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 20/25] ath9k: dynack: fix possible deadlock in ath_dynack_node_{de}init Sasha Levin
2019-10-25 13:57 ` [PATCH AUTOSEL 4.14 24/25] ipv6: Handle race in addrconf_dad_work Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191025135715.25468-13-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+d850c266e3df14da1d31@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).