aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2013-01-26 02:50:54 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-27 01:01:42 -0500
commit9c5e0c0bbc5f683ada546af3c39a5a90b156a6f0 (patch)
treed68bb14e49ebd8ed892e45eb34da0b1e9c12152b /net
parent5588d3742da9900323dc3d766845a53bacdfb5ab (diff)
soreuseport: fix use of uid in tb->fastuid
Fix a reported compilation error where ia variable of type kuid_t was being set to zero. Eliminate two instances of setting tb->fastuid to zero. tb->fastuid is only used if tb->fastreuseport is set, so there should be no problem if tb->fastuid is not initialized (when tb->fastreuesport is zero). Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/inet_connection_sock.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 8bb623d357ad..11cb4979a465 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -204,7 +204,8 @@ tb_found:
204 ret = 1; 204 ret = 1;
205 if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb, true)) { 205 if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb, true)) {
206 if (((sk->sk_reuse && sk->sk_state != TCP_LISTEN) || 206 if (((sk->sk_reuse && sk->sk_state != TCP_LISTEN) ||
207 (sk->sk_reuseport && uid_eq(tb->fastuid, uid))) && 207 (tb->fastreuseport > 0 &&
208 sk->sk_reuseport && uid_eq(tb->fastuid, uid))) &&
208 smallest_size != -1 && --attempts >= 0) { 209 smallest_size != -1 && --attempts >= 0) {
209 spin_unlock(&head->lock); 210 spin_unlock(&head->lock);
210 goto again; 211 goto again;
@@ -227,19 +228,15 @@ tb_not_found:
227 if (sk->sk_reuseport) { 228 if (sk->sk_reuseport) {
228 tb->fastreuseport = 1; 229 tb->fastreuseport = 1;
229 tb->fastuid = uid; 230 tb->fastuid = uid;
230 } else { 231 } else
231 tb->fastreuseport = 0; 232 tb->fastreuseport = 0;
232 tb->fastuid = 0;
233 }
234 } else { 233 } else {
235 if (tb->fastreuse && 234 if (tb->fastreuse &&
236 (!sk->sk_reuse || sk->sk_state == TCP_LISTEN)) 235 (!sk->sk_reuse || sk->sk_state == TCP_LISTEN))
237 tb->fastreuse = 0; 236 tb->fastreuse = 0;
238 if (tb->fastreuseport && 237 if (tb->fastreuseport &&
239 (!sk->sk_reuseport || !uid_eq(tb->fastuid, uid))) { 238 (!sk->sk_reuseport || !uid_eq(tb->fastuid, uid)))
240 tb->fastreuseport = 0; 239 tb->fastreuseport = 0;
241 tb->fastuid = 0;
242 }
243 } 240 }
244success: 241success:
245 if (!inet_csk(sk)->icsk_bind_hash) 242 if (!inet_csk(sk)->icsk_bind_hash)