]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
rds: Un-connected socket sendmsg() with a NULL destination does not fail
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Mon, 18 Dec 2017 15:09:55 +0000 (07:09 -0800)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 1 Feb 2018 23:04:03 +0000 (15:04 -0800)
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: 27463507

Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
net/rds/send.c

index c43b21b83207d39416826b3b510903148c102c05..73a1b8b76b3460a9491e9a366737cbed7353014f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * 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)
        }
 
        lock_sock(sk);
-       if (ipv6_addr_any(&rs->rs_bound_addr)) {
-               if (ipv6_addr_any(&daddr)) {
-                       release_sock(sk);
-                       ret = -ENOTCONN;
-                       goto out;
-               }
+       if (ipv6_addr_any(&rs->rs_bound_addr) || ipv6_addr_any(&daddr)) {
+               release_sock(sk);
+               ret = -ENOTCONN;
+               goto out;
        } else if (namelen != 0) {
                /* Cannot send to an IPv4 address using an IPv6 source
                 * address and cannot send to an IPv6 address using an