Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1421496

[PATCH 4/5] ipvs: Lock socket before setting SK_CAN_REUSE

From Quentin Armitage <quentin@armitage.org.uk>
Newsgroups linux.kernel
Subject [PATCH 4/5] ipvs: Lock socket before setting SK_CAN_REUSE
Date 2016-06-14 04:00 +0200
Message-ID <rJLO2-6jG-15@gated-at.bofh.it> (permalink)
References <rJLO1-6jG-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When other settings are changed in the socket it is locked, so
lock the socket before setting SK_CAN_REUSE.

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
---
 net/netfilter/ipvs/ip_vs_sync.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 29d73d8..dfac9ef 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1540,7 +1540,9 @@ static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id, int ifi
 	}
 
 	/* it is equivalent to the REUSEADDR option in user-space */
+	lock_sock(sock->sk);
 	sock->sk->sk_reuse = SK_CAN_REUSE;
+	release_sock(sock->sk);
 	result = sysctl_sync_sock_size(ipvs);
 	if (result > 0)
 		set_sock_size(sock->sk, 0, result);
-- 
1.7.7.6

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] ipvs: fix backup sync daemon with IPv6, and minor updates Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 04:00 +0200
  [PATCH 3/5] ipvs: Don't check result < 0 after setting result = 0 Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 04:00 +0200
  [PATCH 2/5] ipvs: Stop calling __dev_get_by_name() repeatedly when starting sync daemon Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 04:00 +0200
  [PATCH 4/5] ipvs: Lock socket before setting SK_CAN_REUSE Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 04:00 +0200
    Re: [PATCH 4/5] ipvs: Lock socket before setting SK_CAN_REUSE Eric Dumazet <eric.dumazet@gmail.com> - 2016-06-14 05:20 +0200
    Re: [PATCH 4/5] ipvs: Lock socket before setting SK_CAN_REUSE Eric Dumazet <eric.dumazet@gmail.com> - 2016-06-14 05:20 +0200
  [PATCH 5/5] ipvs: log additional sync daemon parameters Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 04:00 +0200
  [PATCH 1/5] ipvs: Enable setting IPv6 multicast address for ipvs sync daemon backup Quentin Armitage <quentin@armitage.org.uk> - 2016-06-14 04:00 +0200

csiph-web