Skip to content

Commit 3a656c6

Browse files
kcp-gitvijay-suman
authored andcommitted
rds: Second bind() can overwrite the first bind()
In rds_bind(), it does not check if a socket is already bound or not. Hence a second bind() will overwrite what is done in the first bind(). Orabug: 27454254 Signed-off-by: Ka-Cheong Poon <[email protected]> Reviewed-by: Håkon Bugge <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]> Orabug: 33590097 UEK6 => UEK7 (cherry picked from commit df18568) cherry-pick-repo=UEK/production/linux-uek.git Signed-off-by: Gerd Rausch <[email protected]> Reviewed-by: William Kucharski <[email protected]> Orabug: 33590087 UEK7 => LUCI (cherry picked from commit ba4efa8) cherry-pick-repo=UEK/production/linux-uek.git Signed-off-by: Gerd Rausch <[email protected]> Reviewed-by: William Kucharski <[email protected]>
1 parent d9dd29d commit 3a656c6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

net/rds/bind.c

Lines changed: 7 additions & 1 deletion
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
@@ -227,6 +227,12 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
227227

228228
lock_sock(sk);
229229

230+
/* RDS socket does not allow re-binding. */
231+
if (!ipv6_addr_any(&rs->rs_bound_addr)) {
232+
ret = -EINVAL;
233+
goto out;
234+
}
235+
230236
ret = rds_add_bound(rs, binding_addr, &port, scope_id);
231237
if (ret)
232238
goto out;

0 commit comments

Comments
 (0)