Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
torvalds committed Jan 4, 2011
2 parents 8a87694 + 9fc3bbb commit 65f4288
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 25 deletions.
5 changes: 4 additions & 1 deletion drivers/atm/atmtcp.c
Expand Up @@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
atm_dev_put(dev);
return -EMEDIUMTYPE;
}
if (PRIV(dev)->vcc) return -EBUSY;
if (PRIV(dev)->vcc) {
atm_dev_put(dev);
return -EBUSY;
}
}
else {
int error;
Expand Down
1 change: 1 addition & 0 deletions drivers/isdn/gigaset/capi.c
Expand Up @@ -1900,6 +1900,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
if (b3skb == NULL) {
dev_err(cs->dev, "%s: out of memory\n", __func__);
send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
kfree(b3cmsg);
return;
}
capi_cmsg2message(b3cmsg,
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/atlx/atl1.c
Expand Up @@ -3504,6 +3504,8 @@ static int atl1_set_ringparam(struct net_device *netdev,
struct atl1_rfd_ring rfd_old, rfd_new;
struct atl1_rrd_ring rrd_old, rrd_new;
struct atl1_ring_header rhdr_old, rhdr_new;
struct atl1_smb smb;
struct atl1_cmb cmb;
int err;

tpd_old = adapter->tpd_ring;
Expand Down Expand Up @@ -3544,11 +3546,19 @@ static int atl1_set_ringparam(struct net_device *netdev,
adapter->rrd_ring = rrd_old;
adapter->tpd_ring = tpd_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);
adapter->rfd_ring = rfd_new;
adapter->rrd_ring = rrd_new;
adapter->tpd_ring = tpd_new;
adapter->ring_header = rhdr_new;
adapter->smb = smb;
adapter->cmb = cmb;

err = atl1_up(adapter);
if (err)
Expand Down
10 changes: 8 additions & 2 deletions drivers/net/cnic.c
Expand Up @@ -940,15 +940,15 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
&udev->l2_ring_map,
GFP_KERNEL | __GFP_COMP);
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 = PAGE_ALIGN(udev->l2_buf_size);
udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size,
&udev->l2_buf_map,
GFP_KERNEL | __GFP_COMP);
if (!udev->l2_buf)
return -ENOMEM;
goto err_dma;

write_lock(&cnic_dev_lock);
list_add(&udev->list, &cnic_udev_list);
Expand All @@ -959,6 +959,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
cp->udev = udev;

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)
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/ehea/ehea_ethtool.c
Expand Up @@ -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)
{
/* 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
| ETH_FLAG_TXVLAN
| ETH_FLAG_RXVLAN);
Expand Down
9 changes: 7 additions & 2 deletions drivers/net/ppp_generic.c
Expand Up @@ -1285,6 +1285,11 @@ ppp_push(struct ppp *ppp)
}

#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
* send them out the individual links.
Expand Down Expand Up @@ -1347,10 +1352,10 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
if (nfree == 0 || nfree < navail / 2)
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;
len = skb->len;
if (*p == 0) {
if (*p == 0 && mp_protocol_compress) {
++p;
--len;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/skfp/skfddi.c
Expand Up @@ -412,7 +412,7 @@ static int skfp_driver_init(struct net_device *dev)
bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
bp->SharedMemSize,
&bp->SharedMemDMA);
if (!bp->SharedMemSize) {
if (!bp->SharedMemAddr) {
printk("could not allocate mem for ");
printk("hardware module: %ld byte\n",
bp->SharedMemSize);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/starfire.c
Expand Up @@ -148,7 +148,7 @@ static int full_duplex[MAX_UNITS] = {0, };
* This SUCKS.
* 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 */
#define ADDR_64BITS /* This chip uses 64 bit addresses. */
#define netdrv_addr_t __le64
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/tg3.c
Expand Up @@ -12658,7 +12658,7 @@ static void __devinit tg3_read_vpd(struct tg3 *tp)
cnt = pci_read_vpd(tp->pdev, pos,
TG3_NVM_VPD_LEN - pos,
&vpd_data[pos]);
if (cnt == -ETIMEDOUT || -EINTR)
if (cnt == -ETIMEDOUT || cnt == -EINTR)
cnt = 0;
else if (cnt < 0)
goto out_not_found;
Expand Down
22 changes: 19 additions & 3 deletions drivers/usb/atm/ueagle-atm.c
Expand Up @@ -2206,8 +2206,11 @@ static int uea_boot(struct uea_softc *sc)
goto err1;
}

sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm");
if (sc->kthread == ERR_PTR(-ENOMEM)) {
/* Create worker thread, but don't start it here. Start it after
* 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");
goto err2;
}
Expand Down Expand Up @@ -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)
{
struct usb_device *usb = interface_to_usbdev(intf);
int ret;

uea_enters(usb);
uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n",
Expand All @@ -2637,7 +2641,19 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
if (UEA_IS_PREFIRM(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)
Expand Down
28 changes: 18 additions & 10 deletions net/bridge/br_multicast.c
Expand Up @@ -1430,7 +1430,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
struct net_bridge_port *port,
struct sk_buff *skb)
{
struct sk_buff *skb2 = skb;
struct sk_buff *skb2;
struct ipv6hdr *ip6h;
struct icmp6hdr *icmp6h;
u8 nexthdr;
Expand Down Expand Up @@ -1469,15 +1469,15 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
if (!skb2)
return -ENOMEM;

err = -EINVAL;
if (!pskb_may_pull(skb2, offset + sizeof(struct icmp6hdr)))
goto out;

len -= offset - skb_network_offset(skb2);

__skb_pull(skb2, offset);
skb_reset_transport_header(skb2);

err = -EINVAL;
if (!pskb_may_pull(skb2, sizeof(*icmp6h)))
goto out;

icmp6h = icmp6_hdr(skb2);

switch (icmp6h->icmp6_type) {
Expand Down Expand Up @@ -1516,7 +1516,12 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
switch (icmp6h->icmp6_type) {
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;
err = br_ip6_multicast_add_group(br, port, &mld->mld_mca);
break;
Expand All @@ -1529,15 +1534,18 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
break;
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);
}
}

out:
__skb_push(skb2, offset);
if (skb2 != skb)
kfree_skb(skb2);
kfree_skb(skb2);
return err;
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions net/bridge/br_stp_bpdu.c
Expand Up @@ -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);

skb_reset_mac_header(skb);

NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
dev_queue_xmit);
}
Expand Down
4 changes: 2 additions & 2 deletions net/can/bcm.c
Expand Up @@ -125,7 +125,7 @@ struct bcm_sock {
struct list_head tx_ops;
unsigned long dropped_usr_msgs;
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)
Expand Down Expand Up @@ -1521,7 +1521,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,

if (proc_dir) {
/* 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,
proc_dir,
&bcm_proc_fops, sk);
Expand Down
8 changes: 6 additions & 2 deletions net/ipv4/route.c
Expand Up @@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
}

if (res.type == RTN_LOCAL) {
if (!fl.fl4_src)
fl.fl4_src = fl.fl4_dst;
if (!fl.fl4_src) {
if (res.fi->fib_prefsrc)
fl.fl4_src = res.fi->fib_prefsrc;
else
fl.fl4_src = fl.fl4_dst;
}
dev_out = net->loopback_dev;
fl.oif = dev_out->ifindex;
res.fi = NULL;
Expand Down

0 comments on commit 65f4288

Please sign in to comment.