mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-27 16:53:57 +00:00
[NET]: net/core/filter.c: make len cover the entire packet
As suggested by Herbert Xu: Since we don't require anything to be in the linear packet range anymore make len cover the entire packet. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0b05b2a49e
commit
3154e540e3
1 changed files with 2 additions and 6 deletions
|
@ -76,10 +76,6 @@ static inline void *load_pointer(struct sk_buff *skb, int k,
|
||||||
|
|
||||||
int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
|
int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
|
||||||
{
|
{
|
||||||
/* len is UNSIGNED. Byte wide insns relies only on implicit
|
|
||||||
type casts to prevent reading arbitrary memory locations.
|
|
||||||
*/
|
|
||||||
unsigned int len = skb->len-skb->data_len;
|
|
||||||
struct sock_filter *fentry; /* We walk down these */
|
struct sock_filter *fentry; /* We walk down these */
|
||||||
void *ptr;
|
void *ptr;
|
||||||
u32 A = 0; /* Accumulator */
|
u32 A = 0; /* Accumulator */
|
||||||
|
@ -206,10 +202,10 @@ load_b:
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case BPF_LD|BPF_W|BPF_LEN:
|
case BPF_LD|BPF_W|BPF_LEN:
|
||||||
A = len;
|
A = skb->len;
|
||||||
continue;
|
continue;
|
||||||
case BPF_LDX|BPF_W|BPF_LEN:
|
case BPF_LDX|BPF_W|BPF_LEN:
|
||||||
X = len;
|
X = skb->len;
|
||||||
continue;
|
continue;
|
||||||
case BPF_LD|BPF_W|BPF_IND:
|
case BPF_LD|BPF_W|BPF_IND:
|
||||||
k = X + fentry->k;
|
k = X + fentry->k;
|
||||||
|
|
Loading…
Add table
Reference in a new issue