netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/rds: Check laddr_check before calling it
@ 2019-09-17 15:29 Ka-Cheong Poon
  2019-09-17 15:31 ` santosh.shilimkar
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Ka-Cheong Poon @ 2019-09-17 15:29 UTC (permalink / raw)
  To: netdev; +Cc: santosh.shilimkar, davem, rds-devel

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.

Reported-by: syzbot+fae39afd2101a17ec624@syzkaller.appspotmail.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-27 10:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH net] " Ka-Cheong Poon
2019-09-27 10:12   ` David Miller

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).