Skip to content

Commit 26ac82e

Browse files
kcp-gitgerd-rausch
authored andcommitted
rds: Un-connected socket sendmsg() with a NULL destination does not fail
If the destnation address used in sendto()/sendmsg() is NULL, the send call does not fail because the check done in rds_sendmsg() is not correct. Orabug: 27454306 Signed-off-by: Ka-Cheong Poon <[email protected]> Reviewed-by: Håkon Bugge <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent f3a7321 commit 26ac82e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

net/rds/send.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This software is available to you under a choice of one of two
55
* licenses. You may choose to be licensed under the terms of the GNU
@@ -1287,12 +1287,10 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
12871287
}
12881288

12891289
lock_sock(sk);
1290-
if (ipv6_addr_any(&rs->rs_bound_addr)) {
1291-
if (ipv6_addr_any(&daddr)) {
1292-
release_sock(sk);
1293-
ret = -ENOTCONN;
1294-
goto out;
1295-
}
1290+
if (ipv6_addr_any(&rs->rs_bound_addr) || ipv6_addr_any(&daddr)) {
1291+
release_sock(sk);
1292+
ret = -ENOTCONN;
1293+
goto out;
12961294
} else if (namelen != 0) {
12971295
/* Cannot send to an IPv4 address using an IPv6 source
12981296
* address and cannot send to an IPv6 address using an

0 commit comments

Comments
 (0)