Subject: Re: [PATCH 4/4] VSOCK: Fix VSOCK_HASH and VSOCK_CONN_HASH

From: Andy King <[email-masked]>
Date: Thu, 20 Jun 2013 08:12:13 -0700 (PDT)

> If we mod with VSOCK_HASH_SIZE -1, we get 0, 1, .... 249.  Actually, we
> have vsock_bind_table[0 ... 250] and vsock_connected_table[0 .. 250].
> In this case the last entry will never be used.

If I remember correctly, we did this on purpose.  There's actually a
comment about it:

>   * VSOCK_HASH_SIZE + 1 so that vsock_bind_table[0] through
>   * vsock_bind_table[VSOCK_HASH_SIZE - 1] are for bound sockets and
>   * vsock_bind_table[VSOCK_HASH_SIZE] is for unbound sockets.  The hash

[250] is for unbound sockets.  If you hash on that, you'll mistakenly
get an unbound socket when looking for a bound one.

It is confusing, so perhaps a better way is just to move unbound into
its own table.

Thanks!
- Andy