projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rcu: split list.h and move rcu-protected lists into rculist.h
[deliverable/linux.git]
/
net
/
802
/
psnap.c
diff --git
a/net/802/psnap.c
b/net/802/psnap.c
index 04ee43e7538f63af49529b31299747e7dac63f47..ea46439314468e78f5a20539de38e123dc4cd5a9 100644
(file)
--- a/
net/802/psnap.c
+++ b/
net/802/psnap.c
@@
-20,6
+20,7
@@
#include <linux/mm.h>
#include <linux/in.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/in.h>
#include <linux/init.h>
+#include <linux/rculist.h>
static LIST_HEAD(snap_list);
static DEFINE_SPINLOCK(snap_lock);
static LIST_HEAD(snap_list);
static DEFINE_SPINLOCK(snap_lock);
@@
-55,6
+56,9
@@
static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
.type = __constant_htons(ETH_P_SNAP),
};
.type = __constant_htons(ETH_P_SNAP),
};
+ if (unlikely(!pskb_may_pull(skb, 5)))
+ goto drop;
+
rcu_read_lock();
proto = find_snap_client(skb_transport_header(skb));
if (proto) {
rcu_read_lock();
proto = find_snap_client(skb_transport_header(skb));
if (proto) {
@@
-62,14
+66,18
@@
static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
skb->transport_header += 5;
skb_pull_rcsum(skb, 5);
rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
skb->transport_header += 5;
skb_pull_rcsum(skb, 5);
rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
- } else {
- skb->sk = NULL;
- kfree_skb(skb);
- rc = 1;
}
}
-
rcu_read_unlock();
rcu_read_unlock();
+
+ if (unlikely(!proto))
+ goto drop;
+
+out:
return rc;
return rc;
+
+drop:
+ kfree_skb(skb);
+ goto out;
}
/*
}
/*
This page took
0.031744 seconds
and
5
git commands to generate.