From: David S. Miller
Sent: 1/5/2006 4:31:32 PM
> sk_filter() thinks the return value is an int, and applies that
> signed value to skb_trim(), yikes!
>
> Can you fix that up too and respin your patch?
>
> Thanks.
Whoops! Here you go:
--- x/net/core/filter.c 2006-01-05 12:27:17.000000000 -0600
+++ y/net/core/filter.c 2006-01-05 17:02:32.000000000 -0600
@@ -75,7 +75,7 @@ static inline void *load_pointer(struct
* len is the number of filter blocks in the array.
*/
-int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
+unsigned sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
flen)
{
struct sock_filter *fentry; /* We walk down these */
void *ptr;
@@ -241,9 +241,9 @@ load_b:
A = X;
continue;
case BPF_RET|BPF_K:
- return ((unsigned int)fentry->k);
+ return fentry->k;
case BPF_RET|BPF_A:
- return ((unsigned int)A);
+ return A;
case BPF_ST:
mem[fentry->k] = A;
continue;
--- x/include/linux/filter.h 2006-01-02 21:21:10.000000000 -0600
+++ y/include/linux/filter.h 2006-01-05 17:02:58.000000000 -0600
@@ -143,7 +143,7 @@ static inline unsigned int sk_filter_len
struct sk_buff;
struct sock;
-extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
flen);
+extern unsigned sk_run_filter(struct sk_buff *skb, struct sock_filter *filter,
int flen);
extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
extern int sk_chk_filter(struct sock_filter *filter, int flen);
#endif /* __KERNEL__ */
--- x/include/net/sock.h 2006-01-02 21:21:10.000000000 -0600
+++ y/include/net/sock.h 2006-01-05 18:51:05.000000000 -0600
@@ -856,9 +856,7 @@ static inline int sk_filter(struct sock
filter = sk->sk_filter;
if (filter) {
- int pkt_len = sk_run_filter(skb, filter->insns,
- filter->len);
- if (!pkt_len)
+ if (!sk_run_filter(skb, filter->insns, filter->len))
err = -EPERM;
else
skb_trim(skb, pkt_len);
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html