Skip to content

Commit 596fa9e

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
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 ...
2 parents 5938930 + c5c7774 commit 596fa9e

File tree

20 files changed

+147
-81
lines changed

20 files changed

+147
-81
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
764764
struct net_device *bond_dev, *vlan_dev, *upper_dev;
765765
struct vlan_entry *vlan;
766766

767-
rcu_read_lock();
768767
read_lock(&bond->lock);
768+
rcu_read_lock();
769769

770770
bond_dev = bond->dev;
771771

@@ -787,12 +787,19 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
787787
if (vlan_dev)
788788
__bond_resend_igmp_join_requests(vlan_dev);
789789
}
790+
rcu_read_unlock();
790791

791-
if (--bond->igmp_retrans > 0)
792+
/* We use curr_slave_lock to protect against concurrent access to
793+
* igmp_retrans from multiple running instances of this function and
794+
* bond_change_active_slave
795+
*/
796+
write_lock_bh(&bond->curr_slave_lock);
797+
if (bond->igmp_retrans > 1) {
798+
bond->igmp_retrans--;
792799
queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5);
793-
800+
}
801+
write_unlock_bh(&bond->curr_slave_lock);
794802
read_unlock(&bond->lock);
795-
rcu_read_unlock();
796803
}
797804

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

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

19611972
return res;
19621973
}

drivers/net/bonding/bonding.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct bonding {
225225
rwlock_t curr_slave_lock;
226226
u8 send_peer_notif;
227227
s8 setup_by_slave;
228-
s8 igmp_retrans;
228+
u8 igmp_retrans;
229229
#ifdef CONFIG_PROC_FS
230230
struct proc_dir_entry *proc_entry;
231231
char proc_file_name[IFNAMSIZ];

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,9 @@ static int tg3_poll_fw(struct tg3 *tp)
18001800
int i;
18011801
u32 val;
18021802

1803+
if (tg3_flag(tp, NO_FWARE_REPORTED))
1804+
return 0;
1805+
18031806
if (tg3_flag(tp, IS_SSB_CORE)) {
18041807
/* We don't use firmware. */
18051808
return 0;
@@ -10404,6 +10407,13 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
1040410407
*/
1040510408
static int tg3_init_hw(struct tg3 *tp, bool reset_phy)
1040610409
{
10410+
/* Chip may have been just powered on. If so, the boot code may still
10411+
* be running initialization. Wait for it to finish to avoid races in
10412+
* accessing the hardware.
10413+
*/
10414+
tg3_enable_register_access(tp);
10415+
tg3_poll_fw(tp);
10416+
1040710417
tg3_switch_clocks(tp);
1040810418

1040910419
tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0);

drivers/net/ethernet/dec/tulip/interrupt.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ int tulip_refill_rx(struct net_device *dev)
7676

7777
mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
7878
PCI_DMA_FROMDEVICE);
79+
if (dma_mapping_error(&tp->pdev->dev, mapping)) {
80+
dev_kfree_skb(skb);
81+
tp->rx_buffers[entry].skb = NULL;
82+
break;
83+
}
84+
7985
tp->rx_buffers[entry].mapping = mapping;
8086

8187
tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping);

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,6 +4262,9 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id)
42624262
netdev->features |= NETIF_F_HIGHDMA;
42634263
} else {
42644264
status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
4265+
if (!status)
4266+
status = dma_set_coherent_mask(&pdev->dev,
4267+
DMA_BIT_MASK(32));
42654268
if (status) {
42664269
dev_err(&pdev->dev, "Could not set PCI DMA Mask\n");
42674270
goto free_netdev;

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,16 +1401,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status)
14011401
desc_status = edmac_to_cpu(mdp, rxdesc->status);
14021402
pkt_len = rxdesc->frame_length;
14031403

1404-
#if defined(CONFIG_ARCH_R8A7740)
1405-
desc_status >>= 16;
1406-
#endif
1407-
14081404
if (--boguscnt < 0)
14091405
break;
14101406

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

1410+
#if defined(CONFIG_ARCH_R8A7740)
1411+
/*
1412+
* In case of almost all GETHER/ETHERs, the Receive Frame State
1413+
* (RFS) bits in the Receive Descriptor 0 are from bit 9 to
1414+
* bit 0. However, in case of the R8A7740's GETHER, the RFS
1415+
* bits are from bit 25 to bit 16. So, the driver needs right
1416+
* shifting by 16.
1417+
*/
1418+
desc_status >>= 16;
1419+
#endif
1420+
14141421
if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 |
14151422
RD_RFS5 | RD_RFS6 | RD_RFS10)) {
14161423
ndev->stats.rx_errors++;

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
18991899

19001900
#ifdef STMMAC_XMIT_DEBUG
19011901
if (netif_msg_pktdata(priv)) {
1902-
pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d"
1902+
pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d",
19031903
__func__, (priv->cur_tx % txsize),
19041904
(priv->dirty_tx % txsize), entry, first, nfrags);
19051905
if (priv->extend_desc)

drivers/net/ethernet/ti/davinci_mdio.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,12 @@ static int davinci_mdio_suspend(struct device *dev)
459459
static int davinci_mdio_resume(struct device *dev)
460460
{
461461
struct davinci_mdio_data *data = dev_get_drvdata(dev);
462-
u32 ctrl;
463462

464463
pm_runtime_get_sync(data->dev);
465464

466465
spin_lock(&data->lock);
467466
/* restart the scan state machine */
468-
ctrl = __raw_readl(&data->regs->control);
469-
ctrl |= CONTROL_ENABLE;
470-
__raw_writel(ctrl, &data->regs->control);
467+
__davinci_mdio_reset(data);
471468

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

478475
static const struct dev_pm_ops davinci_mdio_pm_ops = {
479-
.suspend = davinci_mdio_suspend,
480-
.resume = davinci_mdio_resume,
476+
.suspend_late = davinci_mdio_suspend,
477+
.resume_early = davinci_mdio_resume,
481478
};
482479

483480
static const struct of_device_id davinci_mdio_of_mtable[] = {

drivers/net/macvlan.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,18 +853,24 @@ static int macvlan_changelink(struct net_device *dev,
853853
struct nlattr *tb[], struct nlattr *data[])
854854
{
855855
struct macvlan_dev *vlan = netdev_priv(dev);
856-
if (data && data[IFLA_MACVLAN_MODE])
857-
vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
856+
858857
if (data && data[IFLA_MACVLAN_FLAGS]) {
859858
__u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]);
860859
bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC;
861-
862-
if (promisc && (flags & MACVLAN_FLAG_NOPROMISC))
863-
dev_set_promiscuity(vlan->lowerdev, -1);
864-
else if (promisc && !(flags & MACVLAN_FLAG_NOPROMISC))
865-
dev_set_promiscuity(vlan->lowerdev, 1);
860+
if (vlan->port->passthru && promisc) {
861+
int err;
862+
863+
if (flags & MACVLAN_FLAG_NOPROMISC)
864+
err = dev_set_promiscuity(vlan->lowerdev, -1);
865+
else
866+
err = dev_set_promiscuity(vlan->lowerdev, 1);
867+
if (err < 0)
868+
return err;
869+
}
866870
vlan->flags = flags;
867871
}
872+
if (data && data[IFLA_MACVLAN_MODE])
873+
vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
868874
return 0;
869875
}
870876

drivers/net/xen-netback/netback.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
662662
{
663663
struct xenvif *vif = NULL, *tmp;
664664
s8 status;
665-
u16 irq, flags;
665+
u16 flags;
666666
struct xen_netif_rx_response *resp;
667667
struct sk_buff_head rxq;
668668
struct sk_buff *skb;
@@ -771,20 +771,21 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
771771
sco->meta_slots_used);
772772

773773
RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
774-
irq = vif->irq;
775-
if (ret && list_empty(&vif->notify_list))
776-
list_add_tail(&vif->notify_list, &notify);
777774

778775
xenvif_notify_tx_completion(vif);
779776

780-
xenvif_put(vif);
777+
if (ret && list_empty(&vif->notify_list))
778+
list_add_tail(&vif->notify_list, &notify);
779+
else
780+
xenvif_put(vif);
781781
npo.meta_cons += sco->meta_slots_used;
782782
dev_kfree_skb(skb);
783783
}
784784

785785
list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
786786
notify_remote_via_irq(vif->irq);
787787
list_del_init(&vif->notify_list);
788+
xenvif_put(vif);
788789
}
789790

790791
/* More work to do? */

drivers/s390/net/netiucv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,7 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata)
20402040
netiucv_setup_netdevice);
20412041
if (!dev)
20422042
return NULL;
2043+
rtnl_lock();
20432044
if (dev_alloc_name(dev, dev->name) < 0)
20442045
goto out_netdev;
20452046

@@ -2061,6 +2062,7 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata)
20612062
out_fsm:
20622063
kfree_fsm(privptr->fsm);
20632064
out_netdev:
2065+
rtnl_unlock();
20642066
free_netdev(dev);
20652067
return NULL;
20662068
}
@@ -2100,6 +2102,7 @@ static ssize_t conn_write(struct device_driver *drv,
21002102

21012103
rc = netiucv_register_device(dev);
21022104
if (rc) {
2105+
rtnl_unlock();
21032106
IUCV_DBF_TEXT_(setup, 2,
21042107
"ret %d from netiucv_register_device\n", rc);
21052108
goto out_free_ndev;
@@ -2109,7 +2112,8 @@ static ssize_t conn_write(struct device_driver *drv,
21092112
priv = netdev_priv(dev);
21102113
SET_NETDEV_DEV(dev, priv->dev);
21112114

2112-
rc = register_netdev(dev);
2115+
rc = register_netdevice(dev);
2116+
rtnl_unlock();
21132117
if (rc)
21142118
goto out_unreg;
21152119

include/net/ip_tunnels.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ struct ip_tunnel_net {
9595
int ip_tunnel_init(struct net_device *dev);
9696
void ip_tunnel_uninit(struct net_device *dev);
9797
void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
98-
int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
99-
struct rtnl_link_ops *ops, char *devname);
98+
int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
99+
struct rtnl_link_ops *ops, char *devname);
100100

101-
void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn);
101+
void ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102102

103103
void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104104
const struct iphdr *tnl_params);

0 commit comments

Comments
 (0)