Skip to content

Commit

Permalink
sfc: Fix assertions in efx_filter_rfs()
Browse files Browse the repository at this point in the history
This function is intended to assert (when DEBUG is defined) that the
skb header area includes the header fields it's looking at, which RFS
should already have pulled.  But it uses pskb_may_pull(), which will
attempt to pull more data if necesary.  It must instead compare
skb_headlen() with the required length.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
  • Loading branch information
Ben Hutchings committed Jun 24, 2011
1 parent a659b2a commit 5893279
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/sfc/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,11 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
return -EPROTONOSUPPORT;

/* RFS must validate the IP header length before calling us */
EFX_BUG_ON_PARANOID(!pskb_may_pull(skb, nhoff + sizeof(*ip)));
EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip));
ip = (const struct iphdr *)(skb->data + nhoff);
if (ip_is_fragment(ip))
return -EPROTONOSUPPORT;
EFX_BUG_ON_PARANOID(!pskb_may_pull(skb, nhoff + 4 * ip->ihl + 4));
EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4);
ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl);

efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 0, rxq_index);
Expand Down

0 comments on commit 5893279

Please sign in to comment.