From: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
To: netdev@vger.kernel.org
Cc: santosh.shilimkar@oracle.com, davem@davemloft.net,
rds-devel@oss.oracle.com
Subject: [PATCH net] net/rds: Check laddr_check before calling it
Date: Tue, 24 Sep 2019 08:51:16 -0700 [thread overview]
Message-ID: <1569340276-13366-1-git-send-email-ka-cheong.poon@oracle.com> (raw)
In-Reply-To: <1568734158-18021-1-git-send-email-ka-cheong.poon@oracle.com>
In rds_bind(), laddr_check is called without checking if it is NULL or
not. And rs_transport should be reset if rds_add_bound() fails.
Fixes: c5c1a030a7db ("net/rds: An rds_sock is added too early to the hash table")
Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
---
net/rds/bind.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/rds/bind.c b/net/rds/bind.c
index 20c156a..5b5fb4c 100644
--- a/net/rds/bind.c
+++ b/net/rds/bind.c
@@ -244,7 +244,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
*/
if (rs->rs_transport) {
trans = rs->rs_transport;
- if (trans->laddr_check(sock_net(sock->sk),
+ if (!trans->laddr_check ||
+ trans->laddr_check(sock_net(sock->sk),
binding_addr, scope_id) != 0) {
ret = -ENOPROTOOPT;
goto out;
@@ -263,6 +264,8 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
sock_set_flag(sk, SOCK_RCU_FREE);
ret = rds_add_bound(rs, binding_addr, &port, scope_id);
+ if (ret)
+ rs->rs_transport = NULL;
out:
release_sock(sk);
--
1.8.3.1
next prev parent reply other threads:[~2019-09-24 15:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 15:29 [PATCH net] net/rds: Check laddr_check before calling it Ka-Cheong Poon
2019-09-17 15:31 ` santosh.shilimkar
2019-09-21 1:09 ` Jakub Kicinski
2019-09-24 15:58 ` Ka-Cheong Poon
2019-09-23 8:52 ` David Miller
2019-09-24 15:27 ` [PATCH net-next] " Ka-Cheong Poon
2019-09-24 15:43 ` Ka-Cheong Poon
2019-09-24 15:51 ` Ka-Cheong Poon [this message]
2019-09-27 10:12 ` [PATCH net] " David Miller
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=1569340276-13366-1-git-send-email-ka-cheong.poon@oracle.com \
--to=ka-cheong.poon@oracle.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=rds-devel@oss.oracle.com \
--cc=santosh.shilimkar@oracle.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).