Commit aa62a869 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  [IRDA]: irda parameters warning fixes.
  [IRDA]: stir4200 fixes.
  [IRDA]: irlmp_unregister_link() needs to free lsaps.
  [IRDA]: mcs7780 needs to free allocated rx buffer.
  [IRDA]: Race between open and disconnect in irda-usb.
  [SCTP]: Flush fragment queue when exiting partial delivery.
  [AX25]: Locking dependencies fix in ax25_disconnect().
  [IPV4]: Make tcp_input_metrics() get minimum RTO via tcp_rto_min()
  [IPV6]: Fix the return value of ipv6_getsockopt
  [BRIDGE]: Assign random address.
  [IPV4]: Updates to nfsroot documentation
  [ATM]: Fix compiler warning noise with FORE200E driver
  [NETFILTER]: bridge: fix missing link layer headers on outgoing routed packets
  [SYNCPPP]: Endianness and 64bit fixes.
  [TIPC]: Fix semaphore handling.
  [NETFILTER]: xt_hashlimit should use time_after_eq()
  [XFRM]: Display the audited SPI value in host byte order.
  [NETFILTER]: ip_tables: fix compat copy race
  [NETFILTER]: ctnetlink: set expected bit for related conntracks
parents de29cba9 a26e01d7
...@@ -92,8 +92,14 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> ...@@ -92,8 +92,14 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
autoconfiguration. autoconfiguration.
The <autoconf> parameter can appear alone as the value to the `ip' The <autoconf> parameter can appear alone as the value to the `ip'
parameter (without all the ':' characters before) in which case auto- parameter (without all the ':' characters before). If the value is
configuration is used. "ip=off" or "ip=none", no autoconfiguration will take place, otherwise
autoconfiguration will take place. The most common way to use this
is "ip=dhcp".
Note that "ip=off" is not the same thing as "ip=::::::off", because in
the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP
are compiled in the kernel.
<client-ip> IP address of the client. <client-ip> IP address of the client.
...@@ -142,7 +148,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> ...@@ -142,7 +148,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
into the kernel will be used, regardless of the value of into the kernel will be used, regardless of the value of
this option. this option.
off or none: don't use autoconfiguration (default) off or none: don't use autoconfiguration
on or any: use any protocol available in the kernel on or any: use any protocol available in the kernel
dhcp: use DHCP dhcp: use DHCP
bootp: use BOOTP bootp: use BOOTP
......
...@@ -2689,7 +2689,7 @@ fore200e_init(struct fore200e* fore200e) ...@@ -2689,7 +2689,7 @@ fore200e_init(struct fore200e* fore200e)
return 0; return 0;
} }
#ifdef CONFIG_ATM_FORE200E_PCA
static int __devinit static int __devinit
fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
{ {
...@@ -2756,7 +2756,6 @@ static void __devexit fore200e_pca_remove_one(struct pci_dev *pci_dev) ...@@ -2756,7 +2756,6 @@ static void __devexit fore200e_pca_remove_one(struct pci_dev *pci_dev)
} }
#ifdef CONFIG_ATM_FORE200E_PCA
static struct pci_device_id fore200e_pca_tbl[] = { static struct pci_device_id fore200e_pca_tbl[] = {
{ PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, PCI_ANY_ID, PCI_ANY_ID, { PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, PCI_ANY_ID, PCI_ANY_ID,
0, 0, (unsigned long) &fore200e_bus[0] }, 0, 0, (unsigned long) &fore200e_bus[0] },
......
...@@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) ...@@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
static int irda_usb_net_open(struct net_device *netdev) static int irda_usb_net_open(struct net_device *netdev)
{ {
struct irda_usb_cb *self; struct irda_usb_cb *self;
unsigned long flags;
char hwname[16]; char hwname[16];
int i; int i;
...@@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_device *netdev) ...@@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_device *netdev)
self = (struct irda_usb_cb *) netdev->priv; self = (struct irda_usb_cb *) netdev->priv;
IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self != NULL, return -1;);
spin_lock_irqsave(&self->lock, flags);
/* Can only open the device if it's there */ /* Can only open the device if it's there */
if(!self->present) { if(!self->present) {
spin_unlock_irqrestore(&self->lock, flags);
IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); IRDA_WARNING("%s(), device not present!\n", __FUNCTION__);
return -1; return -1;
} }
if(self->needspatch) { if(self->needspatch) {
spin_unlock_irqrestore(&self->lock, flags);
IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ;
return -EIO ; return -EIO ;
} }
...@@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_device *netdev) ...@@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_device *netdev)
/* To do *before* submitting Rx urbs and starting net Tx queue /* To do *before* submitting Rx urbs and starting net Tx queue
* Jean II */ * Jean II */
self->netopen = 1; self->netopen = 1;
spin_unlock_irqrestore(&self->lock, flags);
/* /*
* Now that everything should be initialized properly, * Now that everything should be initialized properly,
......
...@@ -677,6 +677,8 @@ static int mcs_net_close(struct net_device *netdev) ...@@ -677,6 +677,8 @@ static int mcs_net_close(struct net_device *netdev)
/* Stop transmit processing */ /* Stop transmit processing */
netif_stop_queue(netdev); netif_stop_queue(netdev);
kfree_skb(mcs->rx_buff.skb);
/* kill and free the receive and transmit URBs */ /* kill and free the receive and transmit URBs */
usb_kill_urb(mcs->rx_urb); usb_kill_urb(mcs->rx_urb);
usb_free_urb(mcs->rx_urb); usb_free_urb(mcs->rx_urb);
......
...@@ -142,9 +142,6 @@ enum StirCtrl2Mask { ...@@ -142,9 +142,6 @@ enum StirCtrl2Mask {
}; };
enum StirFifoCtlMask { enum StirFifoCtlMask {
FIFOCTL_EOF = 0x80,
FIFOCTL_UNDER = 0x40,
FIFOCTL_OVER = 0x20,
FIFOCTL_DIR = 0x10, FIFOCTL_DIR = 0x10,
FIFOCTL_CLR = 0x08, FIFOCTL_CLR = 0x08,
FIFOCTL_EMPTY = 0x04, FIFOCTL_EMPTY = 0x04,
...@@ -594,9 +591,10 @@ static int fifo_txwait(struct stir_cb *stir, int space) ...@@ -594,9 +591,10 @@ static int fifo_txwait(struct stir_cb *stir, int space)
{ {
int err; int err;
unsigned long count, status; unsigned long count, status;
unsigned long prev_count = 0x1fff;
/* Read FIFO status and count */ /* Read FIFO status and count */
for(;;) { for (;; prev_count = count) {
err = read_reg(stir, REG_FIFOCTL, stir->fifo_status, err = read_reg(stir, REG_FIFOCTL, stir->fifo_status,
FIFO_REGS_SIZE); FIFO_REGS_SIZE);
if (unlikely(err != FIFO_REGS_SIZE)) { if (unlikely(err != FIFO_REGS_SIZE)) {
...@@ -629,6 +627,10 @@ static int fifo_txwait(struct stir_cb *stir, int space) ...@@ -629,6 +627,10 @@ static int fifo_txwait(struct stir_cb *stir, int space)
if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count) if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count)
return 0; return 0;
/* queue confused */
if (prev_count < count)
break;
/* estimate transfer time for remaining chars */ /* estimate transfer time for remaining chars */
msleep((count * 8000) / stir->speed); msleep((count * 8000) / stir->speed);
} }
......
...@@ -107,24 +107,24 @@ ...@@ -107,24 +107,24 @@
struct ppp_header { struct ppp_header {
u8 address; u8 address;
u8 control; u8 control;
u16 protocol; __be16 protocol;
}; };
#define PPP_HEADER_LEN sizeof (struct ppp_header) #define PPP_HEADER_LEN sizeof (struct ppp_header)
struct lcp_header { struct lcp_header {
u8 type; u8 type;
u8 ident; u8 ident;
u16 len; __be16 len;
}; };
#define LCP_HEADER_LEN sizeof (struct lcp_header) #define LCP_HEADER_LEN sizeof (struct lcp_header)
struct cisco_packet { struct cisco_packet {
u32 type; __be32 type;
u32 par1; __be32 par1;
u32 par2; __be32 par2;
u16 rel; __be16 rel;
u16 time0; __be16 time0;
u16 time1; __be16 time1;
}; };
#define CISCO_PACKET_LEN 18 #define CISCO_PACKET_LEN 18
#define CISCO_BIG_PACKET_LEN 20 #define CISCO_BIG_PACKET_LEN 20
...@@ -139,7 +139,7 @@ static struct sk_buff_head tx_queue; ...@@ -139,7 +139,7 @@ static struct sk_buff_head tx_queue;
static void sppp_keepalive (unsigned long dummy); static void sppp_keepalive (unsigned long dummy);
static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type,
u8 ident, u16 len, void *data); u8 ident, u16 len, void *data);
static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2); static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2);
static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m);
static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m);
static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m);
...@@ -447,7 +447,7 @@ static void sppp_keepalive (unsigned long dummy) ...@@ -447,7 +447,7 @@ static void sppp_keepalive (unsigned long dummy)
sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq,
sp->pp_rseq); sp->pp_rseq);
else if (sp->lcp.state == LCP_STATE_OPENED) { else if (sp->lcp.state == LCP_STATE_OPENED) {
long nmagic = htonl (sp->lcp.magic); __be32 nmagic = htonl (sp->lcp.magic);
sp->lcp.echoid = ++sp->pp_seq; sp->lcp.echoid = ++sp->pp_seq;
sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ,
sp->lcp.echoid, 4, &nmagic); sp->lcp.echoid, 4, &nmagic);
...@@ -667,7 +667,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb) ...@@ -667,7 +667,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb)
dev->name, len); dev->name, len);
break; break;
} }
if (ntohl (*(long*)(h+1)) == sp->lcp.magic) { if (ntohl (*(__be32*)(h+1)) == sp->lcp.magic) {
/* Line loopback mode detected. */ /* Line loopback mode detected. */
printk (KERN_WARNING "%s: loopback\n", dev->name); printk (KERN_WARNING "%s: loopback\n", dev->name);
if_down (dev); if_down (dev);
...@@ -680,7 +680,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb) ...@@ -680,7 +680,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb)
sppp_lcp_open (sp); sppp_lcp_open (sp);
break; break;
} }
*(long*)(h+1) = htonl (sp->lcp.magic); *(__be32 *)(h+1) = htonl (sp->lcp.magic);
sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1);
break; break;
case LCP_ECHO_REPLY: case LCP_ECHO_REPLY:
...@@ -692,7 +692,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb) ...@@ -692,7 +692,7 @@ static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb)
dev->name, len); dev->name, len);
break; break;
} }
if (ntohl (*(long*)(h+1)) != sp->lcp.magic) if (ntohl(*(__be32 *)(h+1)) != sp->lcp.magic)
sp->pp_alivecnt = 0; sp->pp_alivecnt = 0;
break; break;
} }
...@@ -765,7 +765,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) ...@@ -765,7 +765,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
{ {
struct in_device *in_dev; struct in_device *in_dev;
struct in_ifaddr *ifa; struct in_ifaddr *ifa;
__be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */
#ifdef CONFIG_INET #ifdef CONFIG_INET
rcu_read_lock(); rcu_read_lock();
if ((in_dev = __in_dev_get_rcu(dev)) != NULL) if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
...@@ -782,8 +782,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) ...@@ -782,8 +782,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
} }
rcu_read_unlock(); rcu_read_unlock();
#endif #endif
/* I hope both addr and mask are in the net order */ sppp_cisco_send (sp, CISCO_ADDR_REPLY, ntohl(addr), ntohl(mask));
sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask);
break; break;
} }
} }
...@@ -844,7 +843,7 @@ static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, ...@@ -844,7 +843,7 @@ static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type,
* Send Cisco keepalive packet. * Send Cisco keepalive packet.
*/ */
static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2)
{ {
struct ppp_header *h; struct ppp_header *h;
struct cisco_packet *ch; struct cisco_packet *ch;
...@@ -868,7 +867,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) ...@@ -868,7 +867,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2)
ch->type = htonl (type); ch->type = htonl (type);
ch->par1 = htonl (par1); ch->par1 = htonl (par1);
ch->par2 = htonl (par2); ch->par2 = htonl (par2);
ch->rel = -1; ch->rel = htons(0xffff);
ch->time0 = htons ((u16) (t >> 16)); ch->time0 = htons ((u16) (t >> 16));
ch->time1 = htons ((u16) t); ch->time1 = htons ((u16) t);
......
...@@ -50,7 +50,8 @@ enum nf_br_hook_priorities { ...@@ -50,7 +50,8 @@ enum nf_br_hook_priorities {
extern int nf_bridge_copy_header(struct sk_buff *skb); extern int nf_bridge_copy_header(struct sk_buff *skb);
static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
{ {
if (skb->nf_bridge) if (skb->nf_bridge &&
skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
return nf_bridge_copy_header(skb); return nf_bridge_copy_header(skb);
return 0; return 0;
} }
......
...@@ -279,6 +279,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason) ...@@ -279,6 +279,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
ax25_link_failed(ax25, reason); ax25_link_failed(ax25, reason);
if (ax25->sk != NULL) { if (ax25->sk != NULL) {
local_bh_disable();
bh_lock_sock(ax25->sk); bh_lock_sock(ax25->sk);
ax25->sk->sk_state = TCP_CLOSE; ax25->sk->sk_state = TCP_CLOSE;
ax25->sk->sk_err = reason; ax25->sk->sk_err = reason;
...@@ -288,5 +289,6 @@ void ax25_disconnect(ax25_cb *ax25, int reason) ...@@ -288,5 +289,6 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
sock_set_flag(ax25->sk, SOCK_DEAD); sock_set_flag(ax25->sk, SOCK_DEAD);
} }
bh_unlock_sock(ax25->sk); bh_unlock_sock(ax25->sk);
local_bh_enable();
} }
} }
...@@ -157,8 +157,7 @@ static struct ethtool_ops br_ethtool_ops = { ...@@ -157,8 +157,7 @@ static struct ethtool_ops br_ethtool_ops = {
void br_dev_setup(struct net_device *dev) void br_dev_setup(struct net_device *dev)
{ {
memset(dev->dev_addr, 0, ETH_ALEN); random_ether_addr(dev->dev_addr);
ether_setup(dev); ether_setup(dev);
dev->do_ioctl = br_dev_ioctl; dev->do_ioctl = br_dev_ioctl;
......
...@@ -1396,25 +1396,7 @@ late_initcall(ip_auto_config); ...@@ -1396,25 +1396,7 @@ late_initcall(ip_auto_config);
/* /*
* Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel
* command line parameter. It consists of option fields separated by colons in * command line parameter. See Documentation/nfsroot.txt.
* the following order:
*
* <client-ip>:<server-ip>:<gw-ip>:<netmask>:<host name>:<device>:<PROTO>
*
* Any of the fields can be empty which means to use a default value:
* <client-ip> - address given by BOOTP or RARP
* <server-ip> - address of host returning BOOTP or RARP packet
* <gw-ip> - none, or the address returned by BOOTP
* <netmask> - automatically determined from <client-ip>, or the
* one returned by BOOTP
* <host name> - <client-ip> in ASCII notation, or the name returned
* by BOOTP
* <device> - use all available devices
* <PROTO>:
* off|none - don't do autoconfig at all (DEFAULT)
* on|any - use any configured protocol
* dhcp|bootp|rarp - use only the specified protocol
* both - use both BOOTP and RARP (not DHCP)
*/ */
static int __init ic_proto_name(char *name) static int __init ic_proto_name(char *name)
{ {
......
...@@ -1492,8 +1492,10 @@ static inline int compat_copy_match_to_user(struct ipt_entry_match *m, ...@@ -1492,8 +1492,10 @@ static inline int compat_copy_match_to_user(struct ipt_entry_match *m,
return xt_compat_match_to_user(m, dstptr, size); return xt_compat_match_to_user(m, dstptr, size);
} }
static int compat_copy_entry_to_user(struct ipt_entry *e, static int
void __user **dstptr, compat_uint_t *size) compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr,
compat_uint_t *size, struct xt_counters *counters,
unsigned int *i)
{ {
struct ipt_entry_target *t; struct ipt_entry_target *t;
struct compat_ipt_entry __user *ce; struct compat_ipt_entry __user *ce;
...@@ -1507,6 +1509,9 @@ static int compat_copy_entry_to_user(struct ipt_entry *e, ...@@ -1507,6 +1509,9 @@ static int compat_copy_entry_to_user(struct ipt_entry *e,
if (copy_to_user(ce, e, sizeof(struct ipt_entry))) if (copy_to_user(ce, e, sizeof(struct ipt_entry)))
goto out; goto out;
if (copy_to_user(&ce->counters, &counters[*i], sizeof(counters[*i])))
goto out;
*dstptr += sizeof(struct compat_ipt_entry); *dstptr += sizeof(struct compat_ipt_entry);
ret = IPT_MATCH_ITERATE(e, compat_copy_match_to_user, dstptr, size); ret = IPT_MATCH_ITERATE(e, compat_copy_match_to_user, dstptr, size);
target_offset = e->target_offset - (origsize - *size); target_offset = e->target_offset - (origsize - *size);
...@@ -1522,6 +1527,8 @@ static int compat_copy_entry_to_user(struct ipt_entry *e, ...@@ -1522,6 +1527,8 @@ static int compat_copy_entry_to_user(struct ipt_entry *e,
goto out; goto out;
if (put_user(next_offset, &ce->next_offset)) if (put_user(next_offset, &ce->next_offset))
goto out; goto out;
(*i)++;
return 0; return 0;
out: out:
return ret; return ret;
...@@ -1937,14 +1944,13 @@ struct compat_ipt_get_entries ...@@ -1937,14 +1944,13 @@ struct compat_ipt_get_entries
static int compat_copy_entries_to_user(unsigned int total_size, static int compat_copy_entries_to_user(unsigned int total_size,
struct xt_table *table, void __user *userptr) struct xt_table *table, void __user *userptr)
{ {
unsigned int off, num;
struct compat_ipt_entry e;
struct xt_counters *counters; struct xt_counters *counters;
struct xt_table_info *private = table->private; struct xt_table_info *private = table->private;
void __user *pos; void __user *pos;
unsigned int size; unsigned int size;
int ret = 0; int ret = 0;
void *loc_cpu_entry; void *loc_cpu_entry;
unsigned int i = 0;
counters = alloc_counters(table); counters = alloc_counters(table);
if (IS_ERR(counters)) if (IS_ERR(counters))
...@@ -1958,48 +1964,9 @@ static int compat_copy_entries_to_user(unsigned int total_size, ...@@ -1958,48 +1964,9 @@ static int compat_copy_entries_to_user(unsigned int total_size,
pos = userptr; pos = userptr;
size = total_size; size = total_size;
ret = IPT_ENTRY_ITERATE(loc_cpu_entry, total_size, ret = IPT_ENTRY_ITERATE(loc_cpu_entry, total_size,
compat_copy_entry_to_user, &pos, &size); compat_copy_entry_to_user,
if (ret) &pos, &size, counters, &i);
goto free_counters;
/* ... then go back and fix counters and names */
for (off = 0, num = 0; off < size; off += e.next_offset, num++) {
unsigned int i;
struct ipt_entry_match m;
struct ipt_entry_target t;
ret = -EFAULT;
if (copy_from_user(&e, userptr + off,
sizeof(struct compat_ipt_entry)))
goto free_counters;
if (copy_to_user(userptr + off +
offsetof(struct compat_ipt_entry, counters),
&counters[num], sizeof(counters[num])))
goto free_counters;
for (i = sizeof(struct compat_ipt_entry);
i < e.target_offset; i += m.u.match_size) {
if (copy_from_user(&m, userptr + off + i,
sizeof(struct ipt_entry_match)))
goto free_counters;
if (copy_to_user(userptr + off + i +
offsetof(struct ipt_entry_match, u.user.name),
m.u.kernel.match->name,
strlen(m.u.kernel.match->name) + 1))
goto free_counters;
}
if (copy_from_user(&t, userptr + off + e.target_offset,
sizeof(struct ipt_entry_target)))
goto free_counters;
if (copy_to_user(userptr + off + e.target_offset +
offsetof(struct ipt_entry_target, u.user.name),
t.u.kernel.target->name,
strlen(t.u.kernel.target->name) + 1))
goto free_counters;
}
ret = 0;
free_counters:
vfree(counters); vfree(counters);
return ret; return ret;
} }
......
...@@ -923,7 +923,7 @@ static void tcp_init_metrics(struct sock *sk) ...@@ -923,7 +923,7 @@ static void tcp_init_metrics(struct sock *sk)
} }
if (dst_metric(dst, RTAX_RTTVAR) > tp->mdev) { if (dst_metric(dst, RTAX_RTTVAR) > tp->mdev) {
tp->mdev = dst_metric(dst, RTAX_RTTVAR); tp->mdev = dst_metric(dst, RTAX_RTTVAR);
tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN); tp->mdev_max = tp->rttvar = max(tp->mdev, tcp_rto_min(sk));
} }
tcp_set_rto(sk); tcp_set_rto(sk);
tcp_bound_rto(sk); tcp_bound_rto(sk);
......
...@@ -1046,7 +1046,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1046,7 +1046,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
break; break;
default: default:
return -EINVAL; return -ENOPROTOOPT;
} }
len = min_t(unsigned int, sizeof(int), len); len = min_t(unsigned int, sizeof(int), len);
if(put_user(len, optlen)) if(put_user(len, optlen))
...@@ -1069,9 +1069,8 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1069,9 +1069,8 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); err = do_ipv6_getsockopt(sk, level, optname, optval, optlen);
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
/* we need to exclude all possible EINVALs except default case */ /* we need to exclude all possible ENOPROTOOPTs except default case */
if (err == -EINVAL && optname != IPV6_ADDRFORM && if (err == -ENOPROTOOPT && optname != IPV6_2292PKTOPTIONS) {
optname != MCAST_MSFILTER) {
int len; int len;
if (get_user(len, optlen)) if (get_user(len, optlen))
...@@ -1108,9 +1107,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, ...@@ -1108,9 +1107,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); err = do_ipv6_getsockopt(sk, level, optname, optval, optlen);
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
/* we need to exclude all possible EINVALs except default case */ /* we need to exclude all possible ENOPROTOOPTs except default case */
if (err == -EINVAL && optname != IPV6_ADDRFORM && if (err == -ENOPROTOOPT && optname != IPV6_2292PKTOPTIONS) {
optname != MCAST_MSFILTER) {
int len; int len;
if (get_user(len, optlen)) if (get_user(len, optlen))
......
...@@ -353,6 +353,7 @@ void irlmp_unregister_link(__u32 saddr) ...@@ -353,6 +353,7 @@ void irlmp_unregister_link(__u32 saddr)
/* Final cleanup */ /* Final cleanup */
del_timer(&link->idle_timer); del_timer(&link->idle_timer);
link->magic = 0; link->magic = 0;
hashbin_delete(link->lsaps, (FREE_FUNC) __irlmp_close_lsap);
kfree(link); kfree(link);
} }
} }
......
...@@ -463,7 +463,7 @@ int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len, ...@@ -463,7 +463,7 @@ int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
int n = 0; int n = 0;
IRDA_ASSERT(buf != NULL, return ret;); IRDA_ASSERT(buf != NULL, return ret;);
IRDA_ASSERT(info != 0, return ret;); IRDA_ASSERT(info != NULL, return ret;);
pi_minor = pi & info->pi_mask; pi_minor = pi & info->pi_mask;
pi_major = pi >> info->pi_major_offset; pi_major = pi >> info->pi_major_offset;
...@@ -517,7 +517,7 @@ static int irda_param_extract(void *self, __u8 *buf, int len, ...@@ -517,7 +517,7 @@ static int irda_param_extract(void *self, __u8 *buf, int len,
int n = 0; int n = 0;
IRDA_ASSERT(buf != NULL, return ret;); IRDA_ASSERT(buf != NULL, return ret;);
IRDA_ASSERT(info != 0, return ret;); IRDA_ASSERT(info != NULL, return ret;);
pi_minor = buf[n] & info->pi_mask; pi_minor = buf[n] & info->pi_mask;
pi_major = buf[n] >> info->pi_major_offset; pi_major = buf[n] >> info->pi_major_offset;
...@@ -570,7 +570,7 @@ int irda_param_extract_all(void *self, __u8 *buf, int len, ...@@ -570,7 +570,7 @@ int irda_param_extract_all(void *self, __u8 *buf, int len,
int n = 0; int n = 0;
IRDA_ASSERT(buf != NULL, return ret;); IRDA_ASSERT(buf != NULL, return ret;);
IRDA_ASSERT(info != 0, return ret;); IRDA_ASSERT(info != NULL, return ret;);
/* /*
* Parse all parameters. Each parameter must be at least two bytes * Parse all parameters. Each parameter must be at least two bytes
......
...@@ -1024,8 +1024,10 @@ ctnetlink_create_conntrack(struct nlattr *cda[], ...@@ -1024,8 +1024,10 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
} }
/* setup master conntrack: this is a confirmed expectation */ /* setup master conntrack: this is a confirmed expectation */
if (master_ct) if (master_ct) {
__set_bit(IPS_EXPECTED_BIT, &ct->status);
ct->master = master_ct; ct->master = master_ct;
}
add_timer(&ct->timeout); add_timer(&ct->timeout);
nf_conntrack_hash_insert(ct); nf_conntrack_hash_insert(ct);
......
...@@ -377,7 +377,9 @@ int xt_compat_match_to_user(struct xt_entry_match *m, void __user **dstptr, ...@@ -377,7 +377,9 @@ int xt_compat_match_to_user(struct xt_entry_match *m, void __user **dstptr,
u_int16_t msize = m->u.user.match_size - off; u_int16_t msize = m->u.user.match_size - off;
if (copy_to_user(cm, m, sizeof(*cm)) || if (copy_to_user(cm, m, sizeof(*cm)) ||
put_user(msize, &cm->u.user.match_size)) put_user(msize, &cm->u.user.match_size) ||
copy_to_user(cm->u.user.name, m->u.kernel.match->name,
strlen(m->u.kernel.match->name) + 1))
return -EFAULT; return -EFAULT;
if (match->compat_to_user) { if (match->compat_to_user) {
...@@ -468,7 +470,9 @@ int xt_compat_target_to_user(struct xt_entry_target *t, void __user **dstptr, ...@@ -468,7 +470,9 @@ int xt_compat_target_to_user(struct xt_entry_target *t, void __user **dstptr,
u_int16_t tsize = t->u.user.target_size - off; u_int16_t tsize = t->u.user.target_size - off;
if (copy_to_user(ct, t, sizeof(*ct)) || if (copy_to_user(ct, t, sizeof(*ct)) ||
put_user(tsize, &ct->u.user.target_size)) put_user(tsize, &ct->u.user.target_size) ||
copy_to_user(ct->u.user.name, t->u.kernel.target->name,
strlen(t->u.kernel.target->name) + 1))
return -EFAULT; return -EFAULT;
if (target->compat_to_user) { if (target->compat_to_user) {
......
...@@ -240,7 +240,7 @@ static bool select_all(const struct xt_hashlimit_htable *ht, ...@@ -240,7 +240,7 @@ static bool select_all(const struct xt_hashlimit_htable *ht,
static bool select_gc(const struct xt_hashlimit_htable *ht, static bool select_gc(const struct xt_hashlimit_htable *ht,
const struct dsthash_ent *he) const struct dsthash_ent *he)
{ {
return jiffies >= he->expires; return time_after_eq(jiffies, he->expires);
} }
static void htable_selective_cleanup(struct xt_hashlimit_htable *ht, static void htable_selective_cleanup(struct xt_hashlimit_htable *ht,
......
...@@ -53,6 +53,7 @@ static struct sctp_ulpevent * sctp_ulpq_reasm(struct sctp_ulpq *ulpq, ...@@ -53,6 +53,7 @@ static struct sctp_ulpevent * sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
struct sctp_ulpevent *); struct sctp_ulpevent *);
static struct sctp_ulpevent * sctp_ulpq_order(struct sctp_ulpq *, static struct sctp_ulpevent * sctp_ulpq_order(struct sctp_ulpq *,
struct sctp_ulpevent *); struct sctp_ulpevent *);
static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq);
/* 1st Level Abstractions */ /* 1st Level Abstractions */
...@@ -190,6 +191,7 @@ static void sctp_ulpq_set_pd(struct sctp_ulpq *ulpq) ...@@ -190,6 +191,7 @@ static void sctp_ulpq_set_pd(struct sctp_ulpq *ulpq)
static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq) static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq)
{ {
ulpq->pd_mode = 0; ulpq->pd_mode = 0;
sctp_ulpq_reasm_drain(ulpq);
return sctp_clear_pd(ulpq->asoc->base.sk, ulpq->asoc); return sctp_clear_pd(ulpq->asoc->base.sk, ulpq->asoc);
} }
...@@ -699,6 +701,37 @@ void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 fwd_tsn) ...@@ -699,6 +701,37 @@ void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 fwd_tsn)
} }
} }
/*
* Drain the reassembly queue. If we just cleared parted delivery, it
* is possible that the reassembly queue will contain already reassembled
* messages. Retrieve any such messages and give them to the user.
*/
static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
{
struct sctp_ulpevent *event = NULL;
struct sk_buff_head temp;
if (skb_queue_empty(&ulpq->reasm))
return;
while ((event = sctp_ulpq_retrieve_reassembled(ulpq)) != NULL) {
/* Do ordering if needed. */
if ((event) && (event->msg_flags & MSG_EOR)){
skb_queue_head_init(&temp);
__skb_queue_tail(&temp, sctp_event2skb(event));
event = sctp_ulpq_order(ulpq, event);
}
/* Send event to the ULP. 'event' is the
* sctp_ulpevent for very first SKB on the temp' list.
*/
if (event)
sctp_ulpq_tail_event(ulpq, event);
}
}
/* Helper function to gather skbs that have possibly become /* Helper function to gather skbs that have possibly become
* ordered by an an incoming chunk. * ordered by an an incoming chunk.
*/ */
......
...@@ -253,7 +253,7 @@ static int release(struct socket *sock) ...@@ -253,7 +253,7 @@ static int release(struct socket *sock)
dbg("sock_delete: %x\n",tsock); dbg("sock_delete: %x\n",tsock);
if (!tsock) if (!tsock)
return 0; return 0;
down_interruptible(&tsock->sem); down(&tsock->sem);
if (!sock->sk) { if (!sock->sk) {
up(&tsock->sem); up(&tsock->sem);
return 0; return 0;
......
...@@ -2028,6 +2028,7 @@ void ...@@ -2028,6 +2028,7 @@ void
xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid) xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
{ {
struct audit_buffer *audit_buf; struct audit_buffer *audit_buf;
u32 spi;
extern int audit_enabled; extern int audit_enabled;
if (audit_enabled == 0) if (audit_enabled == 0)
...@@ -2037,8 +2038,8 @@ xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid) ...@@ -2037,8 +2038,8 @@ xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
return; return;
audit_log_format(audit_buf, " op=SAD-add res=%u",result); audit_log_format(audit_buf, " op=SAD-add res=%u",result);
xfrm_audit_common_stateinfo(x, audit_buf); xfrm_audit_common_stateinfo(x, audit_buf);
audit_log_format(audit_buf, " spi=%lu(0x%lx)", spi = ntohl(x->id.spi);
(unsigned long)x->id.spi, (unsigned long)x->id.spi); audit_log_format(audit_buf, " spi=%u(0x%x)", spi, spi);
audit_log_end(audit_buf); audit_log_end(audit_buf);
} }
EXPORT_SYMBOL_GPL(xfrm_audit_state_add); EXPORT_SYMBOL_GPL(xfrm_audit_state_add);
...@@ -2047,6 +2048,7 @@ void ...@@ -2047,6 +2048,7 @@ void
xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid) xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
{ {
struct audit_buffer *audit_buf; struct audit_buffer *audit_buf;
u32 spi;
extern int audit_enabled; extern int audit_enabled;
if (audit_enabled == 0) if (audit_enabled == 0)
...@@ -2056,8 +2058,8 @@ xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid) ...@@ -2056,8 +2058,8 @@ xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
return; return;
audit_log_format(audit_buf, " op=SAD-delete res=%u",result); audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
xfrm_audit_common_stateinfo(x, audit_buf); xfrm_audit_common_stateinfo(x, audit_buf);
audit_log_format(audit_buf, " spi=%lu(0x%lx)", spi = ntohl(x->id.spi);
(unsigned long)x->id.spi, (unsigned long)x->id.spi); audit_log_format(audit_buf, " spi=%u(0x%x)", spi, spi);
audit_log_end(audit_buf); audit_log_end(audit_buf);
} }
EXPORT_SYMBOL_GPL(xfrm_audit_state_delete); EXPORT_SYMBOL_GPL(xfrm_audit_state_delete);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment