Commit 65f42886 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:
  ipv4/route.c: respect prefsrc for local routes
  bridge: stp: ensure mac header is set
  bridge: fix br_multicast_ipv6_rcv for paged skbs
  atl1: fix oops when changing tx/rx ring params
  drivers/atm/atmtcp.c: add missing atm_dev_put
  starfire: Fix dma_addr_t size test for MIPS
  tg3: fix return value check in tg3_read_vpd()
  Broadcom CNIC core network driver: fix mem leak on allocation failures in cnic_alloc_uio_rings()
  ISDN, Gigaset: Fix memory leak in do_disconnect_req()
  CAN: Use inode instead of kernel address for /proc file
  skfp: testing the wrong variable in skfp_driver_init()
  ppp: allow disabling multilink protocol ID compression
  ehea: Avoid changing vlan flags
  ueagle-atm: fix PHY signal initialization race
parents 8a87694e 9fc3bbb4
...@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf) ...@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
atm_dev_put(dev); atm_dev_put(dev);
return -EMEDIUMTYPE; return -EMEDIUMTYPE;
} }
if (PRIV(dev)->vcc) return -EBUSY; if (PRIV(dev)->vcc) {
atm_dev_put(dev);
return -EBUSY;
}
} }
else { else {
int error; int error;
......
...@@ -1900,6 +1900,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif, ...@@ -1900,6 +1900,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
if (b3skb == NULL) { if (b3skb == NULL) {
dev_err(cs->dev, "%s: out of memory\n", __func__); dev_err(cs->dev, "%s: out of memory\n", __func__);
send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
kfree(b3cmsg);
return; return;
} }
capi_cmsg2message(b3cmsg, capi_cmsg2message(b3cmsg,
......
...@@ -3504,6 +3504,8 @@ static int atl1_set_ringparam(struct net_device *netdev, ...@@ -3504,6 +3504,8 @@ static int atl1_set_ringparam(struct net_device *netdev,
struct atl1_rfd_ring rfd_old, rfd_new; struct atl1_rfd_ring rfd_old, rfd_new;
struct atl1_rrd_ring rrd_old, rrd_new; struct atl1_rrd_ring rrd_old, rrd_new;
struct atl1_ring_header rhdr_old, rhdr_new; struct atl1_ring_header rhdr_old, rhdr_new;
struct atl1_smb smb;
struct atl1_cmb cmb;
int err; int err;
tpd_old = adapter->tpd_ring; tpd_old = adapter->tpd_ring;
...@@ -3544,11 +3546,19 @@ static int atl1_set_ringparam(struct net_device *netdev, ...@@ -3544,11 +3546,19 @@ static int atl1_set_ringparam(struct net_device *netdev,
adapter->rrd_ring = rrd_old; adapter->rrd_ring = rrd_old;
adapter->tpd_ring = tpd_old; adapter->tpd_ring = tpd_old;
adapter->ring_header = rhdr_old; adapter->ring_header = rhdr_old;
/*
* Save SMB and CMB, since atl1_free_ring_resources
* will clear them.
*/
smb = adapter->smb;
cmb = adapter->cmb;
atl1_free_ring_resources(adapter); atl1_free_ring_resources(adapter);
adapter->rfd_ring = rfd_new; adapter->rfd_ring = rfd_new;
adapter->rrd_ring = rrd_new; adapter->rrd_ring = rrd_new;
adapter->tpd_ring = tpd_new; adapter->tpd_ring = tpd_new;
adapter->ring_header = rhdr_new; adapter->ring_header = rhdr_new;
adapter->smb = smb;
adapter->cmb = cmb;
err = atl1_up(adapter); err = atl1_up(adapter);
if (err) if (err)
......
...@@ -940,7 +940,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) ...@@ -940,7 +940,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
&udev->l2_ring_map, &udev->l2_ring_map,
GFP_KERNEL | __GFP_COMP); GFP_KERNEL | __GFP_COMP);
if (!udev->l2_ring) if (!udev->l2_ring)
return -ENOMEM; goto err_udev;
udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;
udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size);
...@@ -948,7 +948,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) ...@@ -948,7 +948,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
&udev->l2_buf_map, &udev->l2_buf_map,
GFP_KERNEL | __GFP_COMP); GFP_KERNEL | __GFP_COMP);
if (!udev->l2_buf) if (!udev->l2_buf)
return -ENOMEM; goto err_dma;
write_lock(&cnic_dev_lock); write_lock(&cnic_dev_lock);
list_add(&udev->list, &cnic_udev_list); list_add(&udev->list, &cnic_udev_list);
...@@ -959,6 +959,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) ...@@ -959,6 +959,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
cp->udev = udev; cp->udev = udev;
return 0; return 0;
err_dma:
dma_free_coherent(&udev->pdev->dev, udev->l2_ring_size,
udev->l2_ring, udev->l2_ring_map);
err_udev:
kfree(udev);
return -ENOMEM;
} }
static int cnic_init_uio(struct cnic_dev *dev) static int cnic_init_uio(struct cnic_dev *dev)
......
...@@ -263,6 +263,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev, ...@@ -263,6 +263,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
static int ehea_set_flags(struct net_device *dev, u32 data) static int ehea_set_flags(struct net_device *dev, u32 data)
{ {
/* Avoid changing the VLAN flags */
if ((data & (ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN)) !=
(ethtool_op_get_flags(dev) & (ETH_FLAG_RXVLAN |
ETH_FLAG_TXVLAN))){
return -EINVAL;
}
return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO
| ETH_FLAG_TXVLAN | ETH_FLAG_TXVLAN
| ETH_FLAG_RXVLAN); | ETH_FLAG_RXVLAN);
......
...@@ -1285,6 +1285,11 @@ ppp_push(struct ppp *ppp) ...@@ -1285,6 +1285,11 @@ ppp_push(struct ppp *ppp)
} }
#ifdef CONFIG_PPP_MULTILINK #ifdef CONFIG_PPP_MULTILINK
static bool mp_protocol_compress __read_mostly = true;
module_param(mp_protocol_compress, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(mp_protocol_compress,
"compress protocol id in multilink fragments");
/* /*
* Divide a packet to be transmitted into fragments and * Divide a packet to be transmitted into fragments and
* send them out the individual links. * send them out the individual links.
...@@ -1347,10 +1352,10 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) ...@@ -1347,10 +1352,10 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
if (nfree == 0 || nfree < navail / 2) if (nfree == 0 || nfree < navail / 2)
return 0; /* can't take now, leave it in xmit_pending */ return 0; /* can't take now, leave it in xmit_pending */
/* Do protocol field compression (XXX this should be optional) */ /* Do protocol field compression */
p = skb->data; p = skb->data;
len = skb->len; len = skb->len;
if (*p == 0) { if (*p == 0 && mp_protocol_compress) {
++p; ++p;
--len; --len;
} }
......
...@@ -412,7 +412,7 @@ static int skfp_driver_init(struct net_device *dev) ...@@ -412,7 +412,7 @@ static int skfp_driver_init(struct net_device *dev)
bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev, bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
bp->SharedMemSize, bp->SharedMemSize,
&bp->SharedMemDMA); &bp->SharedMemDMA);
if (!bp->SharedMemSize) { if (!bp->SharedMemAddr) {
printk("could not allocate mem for "); printk("could not allocate mem for ");
printk("hardware module: %ld byte\n", printk("hardware module: %ld byte\n",
bp->SharedMemSize); bp->SharedMemSize);
......
...@@ -148,7 +148,7 @@ static int full_duplex[MAX_UNITS] = {0, }; ...@@ -148,7 +148,7 @@ static int full_duplex[MAX_UNITS] = {0, };
* This SUCKS. * This SUCKS.
* We need a much better method to determine if dma_addr_t is 64-bit. * We need a much better method to determine if dma_addr_t is 64-bit.
*/ */
#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT)) #if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || (defined(CONFIG_MIPS) && ((defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || defined(CONFIG_64BIT))) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT))
/* 64-bit dma_addr_t */ /* 64-bit dma_addr_t */
#define ADDR_64BITS /* This chip uses 64 bit addresses. */ #define ADDR_64BITS /* This chip uses 64 bit addresses. */
#define netdrv_addr_t __le64 #define netdrv_addr_t __le64
......
...@@ -12658,7 +12658,7 @@ static void __devinit tg3_read_vpd(struct tg3 *tp) ...@@ -12658,7 +12658,7 @@ static void __devinit tg3_read_vpd(struct tg3 *tp)
cnt = pci_read_vpd(tp->pdev, pos, cnt = pci_read_vpd(tp->pdev, pos,
TG3_NVM_VPD_LEN - pos, TG3_NVM_VPD_LEN - pos,
&vpd_data[pos]); &vpd_data[pos]);
if (cnt == -ETIMEDOUT || -EINTR) if (cnt == -ETIMEDOUT || cnt == -EINTR)
cnt = 0; cnt = 0;
else if (cnt < 0) else if (cnt < 0)
goto out_not_found; goto out_not_found;
......
...@@ -2206,8 +2206,11 @@ static int uea_boot(struct uea_softc *sc) ...@@ -2206,8 +2206,11 @@ static int uea_boot(struct uea_softc *sc)
goto err1; goto err1;
} }
sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm"); /* Create worker thread, but don't start it here. Start it after
if (sc->kthread == ERR_PTR(-ENOMEM)) { * all usbatm generic initialization is done.
*/
sc->kthread = kthread_create(uea_kthread, sc, "ueagle-atm");
if (IS_ERR(sc->kthread)) {
uea_err(INS_TO_USBDEV(sc), "failed to create thread\n"); uea_err(INS_TO_USBDEV(sc), "failed to create thread\n");
goto err2; goto err2;
} }
...@@ -2624,6 +2627,7 @@ static struct usbatm_driver uea_usbatm_driver = { ...@@ -2624,6 +2627,7 @@ static struct usbatm_driver uea_usbatm_driver = {
static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
{ {
struct usb_device *usb = interface_to_usbdev(intf); struct usb_device *usb = interface_to_usbdev(intf);
int ret;
uea_enters(usb); uea_enters(usb);
uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n", uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n",
...@@ -2637,7 +2641,19 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -2637,7 +2641,19 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
if (UEA_IS_PREFIRM(id)) if (UEA_IS_PREFIRM(id))
return uea_load_firmware(usb, UEA_CHIP_VERSION(id)); return uea_load_firmware(usb, UEA_CHIP_VERSION(id));
return usbatm_usb_probe(intf, id, &uea_usbatm_driver); ret = usbatm_usb_probe(intf, id, &uea_usbatm_driver);
if (ret == 0) {
struct usbatm_data *usbatm = usb_get_intfdata(intf);
struct uea_softc *sc = usbatm->driver_data;
/* Ensure carrier is initialized to off as early as possible */
UPDATE_ATM_SIGNAL(ATM_PHY_SIG_LOST);
/* Only start the worker thread when all init is done */
wake_up_process(sc->kthread);
}
return ret;
} }
static void uea_disconnect(struct usb_interface *intf) static void uea_disconnect(struct usb_interface *intf)
......
...@@ -1430,7 +1430,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, ...@@ -1430,7 +1430,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
struct net_bridge_port *port, struct net_bridge_port *port,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct sk_buff *skb2 = skb; struct sk_buff *skb2;
struct ipv6hdr *ip6h; struct ipv6hdr *ip6h;
struct icmp6hdr *icmp6h; struct icmp6hdr *icmp6h;
u8 nexthdr; u8 nexthdr;
...@@ -1469,15 +1469,15 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, ...@@ -1469,15 +1469,15 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
if (!skb2) if (!skb2)
return -ENOMEM; return -ENOMEM;
err = -EINVAL;
if (!pskb_may_pull(skb2, offset + sizeof(struct icmp6hdr)))
goto out;
len -= offset - skb_network_offset(skb2); len -= offset - skb_network_offset(skb2);
__skb_pull(skb2, offset); __skb_pull(skb2, offset);
skb_reset_transport_header(skb2); skb_reset_transport_header(skb2);
err = -EINVAL;
if (!pskb_may_pull(skb2, sizeof(*icmp6h)))
goto out;
icmp6h = icmp6_hdr(skb2); icmp6h = icmp6_hdr(skb2);
switch (icmp6h->icmp6_type) { switch (icmp6h->icmp6_type) {
...@@ -1516,7 +1516,12 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, ...@@ -1516,7 +1516,12 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
switch (icmp6h->icmp6_type) { switch (icmp6h->icmp6_type) {
case ICMPV6_MGM_REPORT: case ICMPV6_MGM_REPORT:
{ {
struct mld_msg *mld = (struct mld_msg *)icmp6h; struct mld_msg *mld;
if (!pskb_may_pull(skb2, sizeof(*mld))) {
err = -EINVAL;
goto out;
}
mld = (struct mld_msg *)skb_transport_header(skb2);
BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; BR_INPUT_SKB_CB(skb2)->mrouters_only = 1;
err = br_ip6_multicast_add_group(br, port, &mld->mld_mca); err = br_ip6_multicast_add_group(br, port, &mld->mld_mca);
break; break;
...@@ -1529,15 +1534,18 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, ...@@ -1529,15 +1534,18 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
break; break;
case ICMPV6_MGM_REDUCTION: case ICMPV6_MGM_REDUCTION:
{ {
struct mld_msg *mld = (struct mld_msg *)icmp6h; struct mld_msg *mld;
if (!pskb_may_pull(skb2, sizeof(*mld))) {
err = -EINVAL;
goto out;
}
mld = (struct mld_msg *)skb_transport_header(skb2);
br_ip6_multicast_leave_group(br, port, &mld->mld_mca); br_ip6_multicast_leave_group(br, port, &mld->mld_mca);
} }
} }
out: out:
__skb_push(skb2, offset); kfree_skb(skb2);
if (skb2 != skb)
kfree_skb(skb2);
return err; return err;
} }
#endif #endif
......
...@@ -50,6 +50,8 @@ static void br_send_bpdu(struct net_bridge_port *p, ...@@ -50,6 +50,8 @@ static void br_send_bpdu(struct net_bridge_port *p,
llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr); llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr);
skb_reset_mac_header(skb);
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
dev_queue_xmit); dev_queue_xmit);
} }
......
...@@ -125,7 +125,7 @@ struct bcm_sock { ...@@ -125,7 +125,7 @@ struct bcm_sock {
struct list_head tx_ops; struct list_head tx_ops;
unsigned long dropped_usr_msgs; unsigned long dropped_usr_msgs;
struct proc_dir_entry *bcm_proc_read; struct proc_dir_entry *bcm_proc_read;
char procname [20]; /* pointer printed in ASCII with \0 */ char procname [32]; /* inode number in decimal with \0 */
}; };
static inline struct bcm_sock *bcm_sk(const struct sock *sk) static inline struct bcm_sock *bcm_sk(const struct sock *sk)
...@@ -1521,7 +1521,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, ...@@ -1521,7 +1521,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
if (proc_dir) { if (proc_dir) {
/* unique socket address as filename */ /* unique socket address as filename */
sprintf(bo->procname, "%p", sock); sprintf(bo->procname, "%lu", sock_i_ino(sk));
bo->bcm_proc_read = proc_create_data(bo->procname, 0644, bo->bcm_proc_read = proc_create_data(bo->procname, 0644,
proc_dir, proc_dir,
&bcm_proc_fops, sk); &bcm_proc_fops, sk);
......
...@@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, ...@@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
} }
if (res.type == RTN_LOCAL) { if (res.type == RTN_LOCAL) {
if (!fl.fl4_src) if (!fl.fl4_src) {
fl.fl4_src = fl.fl4_dst; if (res.fi->fib_prefsrc)
fl.fl4_src = res.fi->fib_prefsrc;
else
fl.fl4_src = fl.fl4_dst;
}
dev_out = net->loopback_dev; dev_out = net->loopback_dev;
fl.oif = dev_out->ifindex; fl.oif = dev_out->ifindex;
res.fi = NULL; res.fi = NULL;
......
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