Browse Source

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [NET]: Mark Paul Moore as maintainer of labelled networking.
  [VLAN/BRIDGE]: Fix "skb_pull_rcsum - Fatal exception in interrupt"
  [ISDN]: Get rid of some pointless allocation casts in common and bsd comp.
  [NET]: Avoid pointless allocation casts in BSD compression module
  [IRDA]: Do not do pointless kmalloc return value cast in KingSun driver
  [NET]: Fix crash in dev_mc_sync()/dev_mc_unsync()
  [PPPOL2TP]: Fix endianness annotations.
  [IOAT]: ioatdma needs to to play nice in a multi-dma-client world
  [SLIP]: trivial sparse warning fix
  [EQL]: sparse warning fix
  [NET]: is_power_of_2 in net/core/neighbour.c
  [TCP]: Describe tcp_init_cwnd() thoroughly in a comment.
  [NET]: Fix IP_ADD/DROP_MEMBERSHIP to handle only connectionless
  [KBUILD]: Sanitize tc_ematch headers.
  [IPSEC] AH4: Update IPv4 options handling to conform to RFC 4302.
Linus Torvalds 17 years ago
parent
commit
28d9aa613d

+ 6 - 0
MAINTAINERS

@@ -2661,6 +2661,12 @@ L:	netdev@vger.kernel.org
 T:	git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git
 T:	git kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git
 S:	Maintained
 S:	Maintained
 
 
+NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK)
+P:	Paul Moore
+M:	paul.moore@hp.com
+L:	netdev@vger.kernel.org
+S:	Maintained
+
 NETWORKING [WIRELESS]
 NETWORKING [WIRELESS]
 P:	John W. Linville
 P:	John W. Linville
 M:	linville@tuxdriver.com
 M:	linville@tuxdriver.com

+ 4 - 14
drivers/dma/ioatdma.c

@@ -191,17 +191,12 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
 	int i;
 	int i;
 	LIST_HEAD(tmp_list);
 	LIST_HEAD(tmp_list);
 
 
-	/*
-	 * In-use bit automatically set by reading chanctrl
-	 * If 0, we got it, if 1, someone else did
-	 */
-	chanctrl = readw(ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET);
-	if (chanctrl & IOAT_CHANCTRL_CHANNEL_IN_USE)
-		return -EBUSY;
+	/* have we already been set up? */
+	if (!list_empty(&ioat_chan->free_desc))
+		return INITIAL_IOAT_DESC_COUNT;
 
 
         /* Setup register to interrupt and write completion status on error */
         /* Setup register to interrupt and write completion status on error */
-	chanctrl = IOAT_CHANCTRL_CHANNEL_IN_USE |
-		IOAT_CHANCTRL_ERR_INT_EN |
+	chanctrl = IOAT_CHANCTRL_ERR_INT_EN |
 		IOAT_CHANCTRL_ANY_ERR_ABORT_EN |
 		IOAT_CHANCTRL_ANY_ERR_ABORT_EN |
 		IOAT_CHANCTRL_ERR_COMPLETION_EN;
 		IOAT_CHANCTRL_ERR_COMPLETION_EN;
         writew(chanctrl, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET);
         writew(chanctrl, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET);
@@ -282,11 +277,6 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
 			in_use_descs - 1);
 			in_use_descs - 1);
 
 
 	ioat_chan->last_completion = ioat_chan->completion_addr = 0;
 	ioat_chan->last_completion = ioat_chan->completion_addr = 0;
-
-	/* Tell hw the chan is free */
-	chanctrl = readw(ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET);
-	chanctrl &= ~IOAT_CHANCTRL_CHANNEL_IN_USE;
-	writew(chanctrl, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET);
 }
 }
 
 
 static struct dma_async_tx_descriptor *
 static struct dma_async_tx_descriptor *

+ 2 - 3
drivers/isdn/i4l/isdn_bsdcomp.c

@@ -341,7 +341,7 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
 	 * Allocate space for the dictionary. This may be more than one page in
 	 * Allocate space for the dictionary. This may be more than one page in
 	 * length.
 	 * length.
 	 */
 	 */
-	db->dict = (struct bsd_dict *) vmalloc (hsize * sizeof (struct bsd_dict));
+	db->dict = vmalloc(hsize * sizeof(struct bsd_dict));
 	if (!db->dict) {
 	if (!db->dict) {
 		bsd_free (db);
 		bsd_free (db);
 		return NULL;
 		return NULL;
@@ -354,8 +354,7 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data)
 	if (!decomp)
 	if (!decomp)
 		db->lens = NULL;
 		db->lens = NULL;
 	else {
 	else {
-		db->lens = (unsigned short *) vmalloc ((maxmaxcode + 1) *
-			sizeof (db->lens[0]));
+		db->lens = vmalloc((maxmaxcode + 1) * sizeof(db->lens[0]));
 		if (!db->lens) {
 		if (!db->lens) {
 			bsd_free (db);
 			bsd_free (db);
 			return (NULL);
 			return (NULL);

+ 1 - 1
drivers/isdn/i4l/isdn_common.c

@@ -2291,7 +2291,7 @@ static int __init isdn_init(void)
 	int i;
 	int i;
 	char tmprev[50];
 	char tmprev[50];
 
 
-	if (!(dev = (isdn_dev *) vmalloc(sizeof(isdn_dev)))) {
+	if (!(dev = vmalloc(sizeof(isdn_dev)))) {
 		printk(KERN_WARNING "isdn: Could not allocate device-struct.\n");
 		printk(KERN_WARNING "isdn: Could not allocate device-struct.\n");
 		return -EIO;
 		return -EIO;
 	}
 	}

+ 2 - 4
drivers/net/bsd_comp.c

@@ -406,8 +406,7 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp)
  * Allocate space for the dictionary. This may be more than one page in
  * Allocate space for the dictionary. This may be more than one page in
  * length.
  * length.
  */
  */
-    db->dict = (struct bsd_dict *) vmalloc (hsize *
-					    sizeof (struct bsd_dict));
+    db->dict = vmalloc(hsize * sizeof(struct bsd_dict));
     if (!db->dict)
     if (!db->dict)
       {
       {
 	bsd_free (db);
 	bsd_free (db);
@@ -426,8 +425,7 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp)
  */
  */
     else
     else
       {
       {
-        db->lens = (unsigned short *) vmalloc ((maxmaxcode + 1) *
-					       sizeof (db->lens[0]));
+        db->lens = vmalloc((maxmaxcode + 1) * sizeof(db->lens[0]));
 	if (!db->lens)
 	if (!db->lens)
 	  {
 	  {
 	    bsd_free (db);
 	    bsd_free (db);

+ 1 - 1
drivers/net/eql.c

@@ -391,7 +391,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
 		slave_t *duplicate_slave = NULL;
 		slave_t *duplicate_slave = NULL;
 
 
 		duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
 		duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
-		if (duplicate_slave != 0)
+		if (duplicate_slave)
 			eql_kill_one_slave(queue, duplicate_slave);
 			eql_kill_one_slave(queue, duplicate_slave);
 
 
 		list_add(&slave->list, &queue->all_slaves);
 		list_add(&slave->list, &queue->all_slaves);

+ 2 - 2
drivers/net/irda/kingsun-sir.c

@@ -509,12 +509,12 @@ static int kingsun_probe(struct usb_interface *intf,
 	spin_lock_init(&kingsun->lock);
 	spin_lock_init(&kingsun->lock);
 
 
 	/* Allocate input buffer */
 	/* Allocate input buffer */
-	kingsun->in_buf = (__u8 *)kmalloc(kingsun->max_rx, GFP_KERNEL);
+	kingsun->in_buf = kmalloc(kingsun->max_rx, GFP_KERNEL);
 	if (!kingsun->in_buf)
 	if (!kingsun->in_buf)
 		goto free_mem;
 		goto free_mem;
 
 
 	/* Allocate output buffer */
 	/* Allocate output buffer */
-	kingsun->out_buf = (__u8 *)kmalloc(KINGSUN_FIFO_SIZE, GFP_KERNEL);
+	kingsun->out_buf = kmalloc(KINGSUN_FIFO_SIZE, GFP_KERNEL);
 	if (!kingsun->out_buf)
 	if (!kingsun->out_buf)
 		goto free_mem;
 		goto free_mem;
 
 

+ 1 - 1
drivers/net/slip.c

@@ -957,7 +957,7 @@ slip_close(struct tty_struct *tty)
   *			STANDARD SLIP ENCAPSULATION		  	 *
   *			STANDARD SLIP ENCAPSULATION		  	 *
   ************************************************************************/
   ************************************************************************/
 
 
-int
+static int
 slip_esc(unsigned char *s, unsigned char *d, int len)
 slip_esc(unsigned char *s, unsigned char *d, int len)
 {
 {
 	unsigned char *ptr = d;
 	unsigned char *ptr = d;

+ 1 - 0
include/linux/Kbuild

@@ -7,6 +7,7 @@ header-y += raid/
 header-y += spi/
 header-y += spi/
 header-y += sunrpc/
 header-y += sunrpc/
 header-y += tc_act/
 header-y += tc_act/
+header-y += tc_ematch/
 header-y += netfilter/
 header-y += netfilter/
 header-y += netfilter_arp/
 header-y += netfilter_arp/
 header-y += netfilter_bridge/
 header-y += netfilter_bridge/

+ 2 - 2
include/linux/if_pppol2tp.h

@@ -32,8 +32,8 @@ struct pppol2tp_addr
 
 
 	struct sockaddr_in addr;	/* IP address and port to send to */
 	struct sockaddr_in addr;	/* IP address and port to send to */
 
 
-	__be16 s_tunnel, s_session;	/* For matching incoming packets */
-	__be16 d_tunnel, d_session;	/* For sending outgoing packets */
+	__u16 s_tunnel, s_session;	/* For matching incoming packets */
+	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
 };
 };
 
 
 /* Socket options:
 /* Socket options:

+ 11 - 1
net/8021q/vlan_dev.c

@@ -116,12 +116,22 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
 		  struct packet_type* ptype, struct net_device *orig_dev)
 		  struct packet_type* ptype, struct net_device *orig_dev)
 {
 {
 	unsigned char *rawp = NULL;
 	unsigned char *rawp = NULL;
-	struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data);
+	struct vlan_hdr *vhdr;
 	unsigned short vid;
 	unsigned short vid;
 	struct net_device_stats *stats;
 	struct net_device_stats *stats;
 	unsigned short vlan_TCI;
 	unsigned short vlan_TCI;
 	__be16 proto;
 	__be16 proto;
 
 
+	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
+		return -1;
+
+	if (unlikely(!pskb_may_pull(skb, VLAN_HLEN))) {
+		kfree_skb(skb);
+		return -1;
+	}
+
+	vhdr = (struct vlan_hdr *)(skb->data);
+
 	/* vlan_TCI = ntohs(get_unaligned(&vhdr->h_vlan_TCI)); */
 	/* vlan_TCI = ntohs(get_unaligned(&vhdr->h_vlan_TCI)); */
 	vlan_TCI = ntohs(vhdr->h_vlan_TCI);
 	vlan_TCI = ntohs(vhdr->h_vlan_TCI);
 
 

+ 7 - 5
net/bridge/br_netfilter.c

@@ -509,8 +509,14 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
 				      int (*okfn)(struct sk_buff *))
 				      int (*okfn)(struct sk_buff *))
 {
 {
 	struct iphdr *iph;
 	struct iphdr *iph;
-	__u32 len;
 	struct sk_buff *skb = *pskb;
 	struct sk_buff *skb = *pskb;
+	__u32 len = nf_bridge_encap_header_len(skb);
+
+	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
+		return NF_STOLEN;
+
+	if (unlikely(!pskb_may_pull(skb, len)))
+		goto out;
 
 
 	if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) ||
 	if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) ||
 	    IS_PPPOE_IPV6(skb)) {
 	    IS_PPPOE_IPV6(skb)) {
@@ -518,8 +524,6 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
 		if (!brnf_call_ip6tables)
 		if (!brnf_call_ip6tables)
 			return NF_ACCEPT;
 			return NF_ACCEPT;
 #endif
 #endif
-		if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL)
-			goto out;
 		nf_bridge_pull_encap_header_rcsum(skb);
 		nf_bridge_pull_encap_header_rcsum(skb);
 		return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn);
 		return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn);
 	}
 	}
@@ -532,8 +536,6 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
 	    !IS_PPPOE_IP(skb))
 	    !IS_PPPOE_IP(skb))
 		return NF_ACCEPT;
 		return NF_ACCEPT;
 
 
-	if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL)
-		goto out;
 	nf_bridge_pull_encap_header_rcsum(skb);
 	nf_bridge_pull_encap_header_rcsum(skb);
 
 
 	if (!pskb_may_pull(skb, sizeof(struct iphdr)))
 	if (!pskb_may_pull(skb, sizeof(struct iphdr)))

+ 10 - 4
net/core/dev_mcast.c

@@ -116,11 +116,13 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
  */
  */
 int dev_mc_sync(struct net_device *to, struct net_device *from)
 int dev_mc_sync(struct net_device *to, struct net_device *from)
 {
 {
-	struct dev_addr_list *da;
+	struct dev_addr_list *da, *next;
 	int err = 0;
 	int err = 0;
 
 
 	netif_tx_lock_bh(to);
 	netif_tx_lock_bh(to);
-	for (da = from->mc_list; da != NULL; da = da->next) {
+	da = from->mc_list;
+	while (da != NULL) {
+		next = da->next;
 		if (!da->da_synced) {
 		if (!da->da_synced) {
 			err = __dev_addr_add(&to->mc_list, &to->mc_count,
 			err = __dev_addr_add(&to->mc_list, &to->mc_count,
 					     da->da_addr, da->da_addrlen, 0);
 					     da->da_addr, da->da_addrlen, 0);
@@ -134,6 +136,7 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
 			__dev_addr_delete(&from->mc_list, &from->mc_count,
 			__dev_addr_delete(&from->mc_list, &from->mc_count,
 					  da->da_addr, da->da_addrlen, 0);
 					  da->da_addr, da->da_addrlen, 0);
 		}
 		}
+		da = next;
 	}
 	}
 	if (!err)
 	if (!err)
 		__dev_set_rx_mode(to);
 		__dev_set_rx_mode(to);
@@ -156,12 +159,14 @@ EXPORT_SYMBOL(dev_mc_sync);
  */
  */
 void dev_mc_unsync(struct net_device *to, struct net_device *from)
 void dev_mc_unsync(struct net_device *to, struct net_device *from)
 {
 {
-	struct dev_addr_list *da;
+	struct dev_addr_list *da, *next;
 
 
 	netif_tx_lock_bh(from);
 	netif_tx_lock_bh(from);
 	netif_tx_lock_bh(to);
 	netif_tx_lock_bh(to);
 
 
-	for (da = from->mc_list; da != NULL; da = da->next) {
+	da = from->mc_list;
+	while (da != NULL) {
+		next = da->next;
 		if (!da->da_synced)
 		if (!da->da_synced)
 			continue;
 			continue;
 		__dev_addr_delete(&to->mc_list, &to->mc_count,
 		__dev_addr_delete(&to->mc_list, &to->mc_count,
@@ -169,6 +174,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
 		da->da_synced = 0;
 		da->da_synced = 0;
 		__dev_addr_delete(&from->mc_list, &from->mc_count,
 		__dev_addr_delete(&from->mc_list, &from->mc_count,
 				  da->da_addr, da->da_addrlen, 0);
 				  da->da_addr, da->da_addrlen, 0);
+		da = next;
 	}
 	}
 	__dev_set_rx_mode(to);
 	__dev_set_rx_mode(to);
 
 

+ 2 - 1
net/core/neighbour.c

@@ -33,6 +33,7 @@
 #include <linux/rtnetlink.h>
 #include <linux/rtnetlink.h>
 #include <linux/random.h>
 #include <linux/random.h>
 #include <linux/string.h>
 #include <linux/string.h>
+#include <linux/log2.h>
 
 
 #define NEIGH_DEBUG 1
 #define NEIGH_DEBUG 1
 
 
@@ -311,7 +312,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries)
 
 
 	NEIGH_CACHE_STAT_INC(tbl, hash_grows);
 	NEIGH_CACHE_STAT_INC(tbl, hash_grows);
 
 
-	BUG_ON(new_entries & (new_entries - 1));
+	BUG_ON(!is_power_of_2(new_entries));
 	new_hash = neigh_hash_alloc(new_entries);
 	new_hash = neigh_hash_alloc(new_entries);
 	if (!new_hash)
 	if (!new_hash)
 		return;
 		return;

+ 1 - 1
net/ipv4/ah4.c

@@ -46,7 +46,7 @@ static int ip_clear_mutable_options(struct iphdr *iph, __be32 *daddr)
 			memcpy(daddr, optptr+optlen-4, 4);
 			memcpy(daddr, optptr+optlen-4, 4);
 			/* Fall through */
 			/* Fall through */
 		default:
 		default:
-			memset(optptr+2, 0, optlen-2);
+			memset(optptr, 0, optlen);
 		}
 		}
 		l -= optlen;
 		l -= optlen;
 		optptr += optlen;
 		optptr += optlen;

+ 4 - 0
net/ipv4/ip_sockglue.c

@@ -625,6 +625,10 @@ static int do_ip_setsockopt(struct sock *sk, int level,
 	{
 	{
 		struct ip_mreqn mreq;
 		struct ip_mreqn mreq;
 
 
+		err = -EPROTO;
+		if (inet_sk(sk)->is_icsk)
+			break;
+
 		if (optlen < sizeof(struct ip_mreq))
 		if (optlen < sizeof(struct ip_mreq))
 			goto e_inval;
 			goto e_inval;
 		err = -EFAULT;
 		err = -EFAULT;

+ 9 - 1
net/ipv4/tcp_input.c

@@ -755,7 +755,15 @@ void tcp_update_metrics(struct sock *sk)
 	}
 	}
 }
 }
 
 
-/* Numbers are taken from RFC2414.  */
+/* Numbers are taken from RFC3390.
+ *
+ * John Heffner states:
+ *
+ *	The RFC specifies a window of no more than 4380 bytes
+ *	unless 2*MSS > 4380.  Reading the pseudocode in the RFC
+ *	is a bit misleading because they use a clamp at 4380 bytes
+ *	rather than use a multiplier in the relevant range.
+ */
 __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst)
 __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst)
 {
 {
 	__u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0);
 	__u32 cwnd = (dst ? dst_metric(dst, RTAX_INITCWND) : 0);

+ 4 - 0
net/ipv6/ipv6_sockglue.c

@@ -554,6 +554,10 @@ done:
 	{
 	{
 		struct ipv6_mreq mreq;
 		struct ipv6_mreq mreq;
 
 
+		retv = -EPROTO;
+		if (inet_sk(sk)->is_icsk)
+			break;
+
 		retv = -EFAULT;
 		retv = -EFAULT;
 		if (copy_from_user(&mreq, optval, sizeof(struct ipv6_mreq)))
 		if (copy_from_user(&mreq, optval, sizeof(struct ipv6_mreq)))
 			break;
 			break;