aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-01-03 17:48:58 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-04 16:31:50 -0500
commit0347af510cb8d9bf3014042bf1d2f23d9065f5d2 (patch)
tree3f4bbfd3fdcb037faa637107ee2c3dc64f104f24 /drivers/s390
parent43c00a75d205ffee165c40f37edb1d2173dea7ea (diff)
qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock
Also benefit from rcu_read_lock held and use __in_dev_get_rcu() in ipv4 case. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/qeth_l3_main.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 6e5eef01e667..0749efe1c6d9 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1640,6 +1640,7 @@ static void qeth_l3_add_mc(struct qeth_card *card, struct in_device *in4_dev)
1640 } 1640 }
1641} 1641}
1642 1642
1643/* called with rcu_read_lock */
1643static void qeth_l3_add_vlan_mc(struct qeth_card *card) 1644static void qeth_l3_add_vlan_mc(struct qeth_card *card)
1644{ 1645{
1645 struct in_device *in_dev; 1646 struct in_device *in_dev;
@@ -1652,19 +1653,14 @@ static void qeth_l3_add_vlan_mc(struct qeth_card *card)
1652 for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { 1653 for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) {
1653 struct net_device *netdev; 1654 struct net_device *netdev;
1654 1655
1655 rcu_read_lock();
1656 netdev = __vlan_find_dev_deep(card->dev, vid); 1656 netdev = __vlan_find_dev_deep(card->dev, vid);
1657 rcu_read_unlock();
1658 if (netdev == NULL || 1657 if (netdev == NULL ||
1659 !(netdev->flags & IFF_UP)) 1658 !(netdev->flags & IFF_UP))
1660 continue; 1659 continue;
1661 in_dev = in_dev_get(netdev); 1660 in_dev = __in_dev_get_rcu(netdev);
1662 if (!in_dev) 1661 if (!in_dev)
1663 continue; 1662 continue;
1664 rcu_read_lock();
1665 qeth_l3_add_mc(card, in_dev); 1663 qeth_l3_add_mc(card, in_dev);
1666 rcu_read_unlock();
1667 in_dev_put(in_dev);
1668 } 1664 }
1669} 1665}
1670 1666
@@ -1673,14 +1669,14 @@ static void qeth_l3_add_multicast_ipv4(struct qeth_card *card)
1673 struct in_device *in4_dev; 1669 struct in_device *in4_dev;
1674 1670
1675 QETH_CARD_TEXT(card, 4, "chkmcv4"); 1671 QETH_CARD_TEXT(card, 4, "chkmcv4");
1676 in4_dev = in_dev_get(card->dev);
1677 if (in4_dev == NULL)
1678 return;
1679 rcu_read_lock(); 1672 rcu_read_lock();
1673 in4_dev = __in_dev_get_rcu(card->dev);
1674 if (in4_dev == NULL)
1675 goto unlock;
1680 qeth_l3_add_mc(card, in4_dev); 1676 qeth_l3_add_mc(card, in4_dev);
1681 qeth_l3_add_vlan_mc(card); 1677 qeth_l3_add_vlan_mc(card);
1678unlock:
1682 rcu_read_unlock(); 1679 rcu_read_unlock();
1683 in_dev_put(in4_dev);
1684} 1680}
1685 1681
1686#ifdef CONFIG_QETH_IPV6 1682#ifdef CONFIG_QETH_IPV6
@@ -1705,6 +1701,7 @@ static void qeth_l3_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev)
1705 } 1701 }
1706} 1702}
1707 1703
1704/* called with rcu_read_lock */
1708static void qeth_l3_add_vlan_mc6(struct qeth_card *card) 1705static void qeth_l3_add_vlan_mc6(struct qeth_card *card)
1709{ 1706{
1710 struct inet6_dev *in_dev; 1707 struct inet6_dev *in_dev;
@@ -1741,10 +1738,12 @@ static void qeth_l3_add_multicast_ipv6(struct qeth_card *card)
1741 in6_dev = in6_dev_get(card->dev); 1738 in6_dev = in6_dev_get(card->dev);
1742 if (in6_dev == NULL) 1739 if (in6_dev == NULL)
1743 return; 1740 return;
1741 rcu_read_lock();
1744 read_lock_bh(&in6_dev->lock); 1742 read_lock_bh(&in6_dev->lock);
1745 qeth_l3_add_mc6(card, in6_dev); 1743 qeth_l3_add_mc6(card, in6_dev);
1746 qeth_l3_add_vlan_mc6(card); 1744 qeth_l3_add_vlan_mc6(card);
1747 read_unlock_bh(&in6_dev->lock); 1745 read_unlock_bh(&in6_dev->lock);
1746 rcu_read_unlock();
1748 in6_dev_put(in6_dev); 1747 in6_dev_put(in6_dev);
1749} 1748}
1750#endif /* CONFIG_QETH_IPV6 */ 1749#endif /* CONFIG_QETH_IPV6 */
@@ -1813,8 +1812,10 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card,
1813static void qeth_l3_free_vlan_addresses(struct qeth_card *card, 1812static void qeth_l3_free_vlan_addresses(struct qeth_card *card,
1814 unsigned short vid) 1813 unsigned short vid)
1815{ 1814{
1815 rcu_read_lock();
1816 qeth_l3_free_vlan_addresses4(card, vid); 1816 qeth_l3_free_vlan_addresses4(card, vid);
1817 qeth_l3_free_vlan_addresses6(card, vid); 1817 qeth_l3_free_vlan_addresses6(card, vid);
1818 rcu_read_unlock();
1818} 1819}
1819 1820
1820static int qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 1821static int qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)