Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
Pull networking fixes from David Miller:

 1) Fix RTNL locking in batman-adv, from Matthias Schiffer.

 2) Don't allow non-passthrough macvlan devices to set NOPROMISC via
    netlink, otherwise we can end up with corrupted promisc counter
    values on the device.  From Michael S Tsirkin.

 3) Fix stmmac driver build with debugging defines enabled, from Dinh
    Nguyen.

 4) Make sure name string we give in socket address in AF_PACKET is NULL
    terminated, from Daniel Borkmann.

 5) Fix leaking of two uninitialized bytes of memory to userspace in
    l2tp, from Guillaume Nault.

 6) Clear IPCB(skb) before tunneling otherwise we touch dangling IP
    options state and crash.  From Saurabh Mohan.

 7) Fix suspend/resume for davinci_mdio by using suspend_late and
    resume_early.  From Mugunthan V N.

 8) Don't tag ip_tunnel_init_net and ip_tunnel_delete_net with
    __net_{init,exit}, they can be called outside of those contexts.
    From Eric Dumazet.

 9) Fix RX length error in sh_eth driver, from Yoshihiro Shimoda.

10) Fix missing sctp_outq initialization in some code paths of SCTP
    stack, from Neil Horman.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (21 commits)
  sctp: fully initialize sctp_outq in sctp_outq_init
  netiucv: Hold rtnl between name allocation and device registration.
  tulip: Properly check dma mapping result
  net: sh_eth: fix incorrect RX length error if R8A7740
  ip_tunnel: remove __net_init/exit from exported functions
  drivers: net: davinci_mdio: restore mdio clk divider in mdio resume
  drivers: net: davinci_mdio: moving mdio resume earlier than cpsw ethernet driver
  net/ipv4: ip_vti clear skb cb before tunneling.
  tg3: Wait for boot code to finish after power on
  l2tp: Fix sendmsg() return value
  l2tp: Fix PPP header erasure and memory leak
  bonding: fix igmp_retrans type and two related races
  bonding: reset master mac on first enslave failure
  packet: packet_getname_spkt: make sure string is always 0-terminated
  net: ethernet: stmicro: stmmac: Fix compile error when STMMAC_XMIT_DEBUG used
  be2net: Fix 32-bit DMA Mask handling
  xen-netback: don't de-reference vif pointer after having called xenvif_put()
  macvlan: don't touch promisc without passthrough
  batman-adv: Don't handle address updates when bla is disabled
  batman-adv: forward late OGMs from best next hop
  ...
  • Loading branch information
torvalds committed Jun 15, 2013
2 parents 5938930 + c5c7774 commit 596fa9e
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 81 deletions.
19 changes: 15 additions & 4 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
struct net_device *bond_dev, *vlan_dev, *upper_dev;
struct vlan_entry *vlan;

rcu_read_lock();
read_lock(&bond->lock);
rcu_read_lock();

bond_dev = bond->dev;

Expand All @@ -787,12 +787,19 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
if (vlan_dev)
__bond_resend_igmp_join_requests(vlan_dev);
}
rcu_read_unlock();

if (--bond->igmp_retrans > 0)
/* We use curr_slave_lock to protect against concurrent access to
* igmp_retrans from multiple running instances of this function and
* bond_change_active_slave
*/
write_lock_bh(&bond->curr_slave_lock);
if (bond->igmp_retrans > 1) {
bond->igmp_retrans--;
queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5);

}
write_unlock_bh(&bond->curr_slave_lock);
read_unlock(&bond->lock);
rcu_read_unlock();
}

static void bond_resend_igmp_join_requests_delayed(struct work_struct *work)
Expand Down Expand Up @@ -1957,6 +1964,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)

err_undo_flags:
bond_compute_features(bond);
/* Enslave of first slave has failed and we need to fix master's mac */
if (bond->slave_cnt == 0 &&
ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr))
eth_hw_addr_random(bond_dev);

return res;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bonding.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct bonding {
rwlock_t curr_slave_lock;
u8 send_peer_notif;
s8 setup_by_slave;
s8 igmp_retrans;
u8 igmp_retrans;
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_entry;
char proc_file_name[IFNAMSIZ];
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,9 @@ static int tg3_poll_fw(struct tg3 *tp)
int i;
u32 val;

if (tg3_flag(tp, NO_FWARE_REPORTED))
return 0;

if (tg3_flag(tp, IS_SSB_CORE)) {
/* We don't use firmware. */
return 0;
Expand Down Expand Up @@ -10404,6 +10407,13 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
*/
static int tg3_init_hw(struct tg3 *tp, bool reset_phy)
{
/* Chip may have been just powered on. If so, the boot code may still
* be running initialization. Wait for it to finish to avoid races in
* accessing the hardware.
*/
tg3_enable_register_access(tp);
tg3_poll_fw(tp);

tg3_switch_clocks(tp);

tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/ethernet/dec/tulip/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ int tulip_refill_rx(struct net_device *dev)

mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
PCI_DMA_FROMDEVICE);
if (dma_mapping_error(&tp->pdev->dev, mapping)) {
dev_kfree_skb(skb);
tp->rx_buffers[entry].skb = NULL;
break;
}

tp->rx_buffers[entry].mapping = mapping;

tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4262,6 +4262,9 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
netdev->features |= NETIF_F_HIGHDMA;
} else {
status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
if (!status)
status = dma_set_coherent_mask(&pdev->dev,
DMA_BIT_MASK(32));
if (status) {
dev_err(&pdev->dev, "Could not set PCI DMA Mask\n");
goto free_netdev;
Expand Down
15 changes: 11 additions & 4 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1401,16 +1401,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status)
desc_status = edmac_to_cpu(mdp, rxdesc->status);
pkt_len = rxdesc->frame_length;

#if defined(CONFIG_ARCH_R8A7740)
desc_status >>= 16;
#endif

if (--boguscnt < 0)
break;

if (!(desc_status & RDFEND))
ndev->stats.rx_length_errors++;

#if defined(CONFIG_ARCH_R8A7740)
/*
* In case of almost all GETHER/ETHERs, the Receive Frame State
* (RFS) bits in the Receive Descriptor 0 are from bit 9 to
* bit 0. However, in case of the R8A7740's GETHER, the RFS
* bits are from bit 25 to bit 16. So, the driver needs right
* shifting by 16.
*/
desc_status >>= 16;
#endif

if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 |
RD_RFS5 | RD_RFS6 | RD_RFS10)) {
ndev->stats.rx_errors++;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)

#ifdef STMMAC_XMIT_DEBUG
if (netif_msg_pktdata(priv)) {
pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d"
pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d",
__func__, (priv->cur_tx % txsize),
(priv->dirty_tx % txsize), entry, first, nfrags);
if (priv->extend_desc)
Expand Down
9 changes: 3 additions & 6 deletions drivers/net/ethernet/ti/davinci_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,12 @@ static int davinci_mdio_suspend(struct device *dev)
static int davinci_mdio_resume(struct device *dev)
{
struct davinci_mdio_data *data = dev_get_drvdata(dev);
u32 ctrl;

pm_runtime_get_sync(data->dev);

spin_lock(&data->lock);
/* restart the scan state machine */
ctrl = __raw_readl(&data->regs->control);
ctrl |= CONTROL_ENABLE;
__raw_writel(ctrl, &data->regs->control);
__davinci_mdio_reset(data);

data->suspended = false;
spin_unlock(&data->lock);
Expand All @@ -476,8 +473,8 @@ static int davinci_mdio_resume(struct device *dev)
}

static const struct dev_pm_ops davinci_mdio_pm_ops = {
.suspend = davinci_mdio_suspend,
.resume = davinci_mdio_resume,
.suspend_late = davinci_mdio_suspend,
.resume_early = davinci_mdio_resume,
};

static const struct of_device_id davinci_mdio_of_mtable[] = {
Expand Down
20 changes: 13 additions & 7 deletions drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,18 +853,24 @@ static int macvlan_changelink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
struct macvlan_dev *vlan = netdev_priv(dev);
if (data && data[IFLA_MACVLAN_MODE])
vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);

if (data && data[IFLA_MACVLAN_FLAGS]) {
__u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]);
bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC;

if (promisc && (flags & MACVLAN_FLAG_NOPROMISC))
dev_set_promiscuity(vlan->lowerdev, -1);
else if (promisc && !(flags & MACVLAN_FLAG_NOPROMISC))
dev_set_promiscuity(vlan->lowerdev, 1);
if (vlan->port->passthru && promisc) {
int err;

if (flags & MACVLAN_FLAG_NOPROMISC)
err = dev_set_promiscuity(vlan->lowerdev, -1);
else
err = dev_set_promiscuity(vlan->lowerdev, 1);
if (err < 0)
return err;
}
vlan->flags = flags;
}
if (data && data[IFLA_MACVLAN_MODE])
vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
return 0;
}

Expand Down
11 changes: 6 additions & 5 deletions drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
{
struct xenvif *vif = NULL, *tmp;
s8 status;
u16 irq, flags;
u16 flags;
struct xen_netif_rx_response *resp;
struct sk_buff_head rxq;
struct sk_buff *skb;
Expand Down Expand Up @@ -771,20 +771,21 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
sco->meta_slots_used);

RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
irq = vif->irq;
if (ret && list_empty(&vif->notify_list))
list_add_tail(&vif->notify_list, &notify);

xenvif_notify_tx_completion(vif);

xenvif_put(vif);
if (ret && list_empty(&vif->notify_list))
list_add_tail(&vif->notify_list, &notify);
else
xenvif_put(vif);
npo.meta_cons += sco->meta_slots_used;
dev_kfree_skb(skb);
}

list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
notify_remote_via_irq(vif->irq);
list_del_init(&vif->notify_list);
xenvif_put(vif);
}

/* More work to do? */
Expand Down
6 changes: 5 additions & 1 deletion drivers/s390/net/netiucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,7 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata)
netiucv_setup_netdevice);
if (!dev)
return NULL;
rtnl_lock();
if (dev_alloc_name(dev, dev->name) < 0)
goto out_netdev;

Expand All @@ -2061,6 +2062,7 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata)
out_fsm:
kfree_fsm(privptr->fsm);
out_netdev:
rtnl_unlock();
free_netdev(dev);
return NULL;
}
Expand Down Expand Up @@ -2100,6 +2102,7 @@ static ssize_t conn_write(struct device_driver *drv,

rc = netiucv_register_device(dev);
if (rc) {
rtnl_unlock();
IUCV_DBF_TEXT_(setup, 2,
"ret %d from netiucv_register_device\n", rc);
goto out_free_ndev;
Expand All @@ -2109,7 +2112,8 @@ static ssize_t conn_write(struct device_driver *drv,
priv = netdev_priv(dev);
SET_NETDEV_DEV(dev, priv->dev);

rc = register_netdev(dev);
rc = register_netdevice(dev);
rtnl_unlock();
if (rc)
goto out_unreg;

Expand Down
6 changes: 3 additions & 3 deletions include/net/ip_tunnels.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ struct ip_tunnel_net {
int ip_tunnel_init(struct net_device *dev);
void ip_tunnel_uninit(struct net_device *dev);
void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
struct rtnl_link_ops *ops, char *devname);
int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
struct rtnl_link_ops *ops, char *devname);

void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn);
void ip_tunnel_delete_net(struct ip_tunnel_net *itn);

void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
const struct iphdr *tnl_params);
Expand Down
Loading

0 comments on commit 596fa9e

Please sign in to comment.