inet: Sanitize inet{,6} protocol demux.
Don't pretend that inet_protos[] and inet6_protos[] are hashes, thay are just a straight arrays. Remove all unnecessary hash masking. Document MAX_INET_PROTOS. Use RAW_HTABLE_SIZE when appropriate. Reported-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@ -198,14 +198,13 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
|
||||
rcu_read_lock();
|
||||
{
|
||||
int protocol = ip_hdr(skb)->protocol;
|
||||
int hash, raw;
|
||||
const struct net_protocol *ipprot;
|
||||
int raw;
|
||||
|
||||
resubmit:
|
||||
raw = raw_local_deliver(skb, protocol);
|
||||
|
||||
hash = protocol & (MAX_INET_PROTOS - 1);
|
||||
ipprot = rcu_dereference(inet_protos[hash]);
|
||||
ipprot = rcu_dereference(inet_protos[protocol]);
|
||||
if (ipprot != NULL) {
|
||||
int ret;
|
||||
|
||||
|
Reference in New Issue
Block a user