aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-06 18:19:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-06 18:19:59 -0400
commit442bb4bad90134e1c49ffb3ccdefca391ce05600 (patch)
tree2e8796f8193001595e050909b482ac29cba0f1b0 /net/dsa/dsa.c
parent9e441639d1ed78245600191f0fa45e106935a9dc (diff)
parentfde913e25496761a4e2a4c81230c913aba6289a2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) In TCP, don't register an FRTO for cumulatively ACK'd data that was previously SACK'd, from Neal Cardwell. 2) Need to hold RNL mutex in ipv4 multicast code namespace cleanup, from Cong WANG. 3) Similarly we have to hold RNL mutex for fib_rules_unregister(), also from Cong WANG. 4) Revert and rework netns nsid allocation fix, from Nicolas Dichtel. 5) When we encapsulate for a tunnel device, skb->sk still points to the user socket. So this leads to cases where we retraverse the ipv4/ipv6 output path with skb->sk being of some other address family (f.e. AF_PACKET). This can cause things to crash since the ipv4 output path is dereferencing an AF_PACKET socket as if it were an ipv4 one. The short term fix for 'net' and -stable is to elide these socket checks once we've entered an encapsulation sequence by testing xmit_recursion. Longer term we have a better solution wherein we pass the tunnel's socket down through the output paths, but that is way too invasive for 'net' and -stable. From Hannes Frederic Sowa. 6) l2tp_init() failure path forgets to unregister per-net ops, from Cong WANG. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: net/mlx4_core: Fix error message deprecation for ConnectX-2 cards net: dsa: fix filling routing table from OF description l2tp: unregister l2tp_net_ops on failure path mvneta: dont call mvneta_adjust_link() manually ipv6: protect skb->sk accesses from recursive dereference inside the stack netns: don't allocate an id for dead netns Revert "netns: don't clear nsid too early on removal" ip6mr: call del_timer_sync() in ip6mr_free_table() net: move fib_rules_unregister() under rtnl lock ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup tcp: fix FRTO undo on cumulative ACK of SACKed range xen-netfront: transmit fully GSO-sized packets
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 2173402d87e0..4dea2e0681d1 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -501,12 +501,10 @@ static struct net_device *dev_to_net_device(struct device *dev)
501#ifdef CONFIG_OF 501#ifdef CONFIG_OF
502static int dsa_of_setup_routing_table(struct dsa_platform_data *pd, 502static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
503 struct dsa_chip_data *cd, 503 struct dsa_chip_data *cd,
504 int chip_index, 504 int chip_index, int port_index,
505 struct device_node *link) 505 struct device_node *link)
506{ 506{
507 int ret;
508 const __be32 *reg; 507 const __be32 *reg;
509 int link_port_addr;
510 int link_sw_addr; 508 int link_sw_addr;
511 struct device_node *parent_sw; 509 struct device_node *parent_sw;
512 int len; 510 int len;
@@ -519,6 +517,10 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
519 if (!reg || (len != sizeof(*reg) * 2)) 517 if (!reg || (len != sizeof(*reg) * 2))
520 return -EINVAL; 518 return -EINVAL;
521 519
520 /*
521 * Get the destination switch number from the second field of its 'reg'
522 * property, i.e. for "reg = <0x19 1>" sw_addr is '1'.
523 */
522 link_sw_addr = be32_to_cpup(reg + 1); 524 link_sw_addr = be32_to_cpup(reg + 1);
523 525
524 if (link_sw_addr >= pd->nr_chips) 526 if (link_sw_addr >= pd->nr_chips)
@@ -535,20 +537,9 @@ static int dsa_of_setup_routing_table(struct dsa_platform_data *pd,
535 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8)); 537 memset(cd->rtable, -1, pd->nr_chips * sizeof(s8));
536 } 538 }
537 539
538 reg = of_get_property(link, "reg", NULL); 540 cd->rtable[link_sw_addr] = port_index;
539 if (!reg) {
540 ret = -EINVAL;
541 goto out;
542 }
543
544 link_port_addr = be32_to_cpup(reg);
545
546 cd->rtable[link_sw_addr] = link_port_addr;
547 541
548 return 0; 542 return 0;
549out:
550 kfree(cd->rtable);
551 return ret;
552} 543}
553 544
554static void dsa_of_free_platform_data(struct dsa_platform_data *pd) 545static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
@@ -658,7 +649,7 @@ static int dsa_of_probe(struct platform_device *pdev)
658 if (!strcmp(port_name, "dsa") && link && 649 if (!strcmp(port_name, "dsa") && link &&
659 pd->nr_chips > 1) { 650 pd->nr_chips > 1) {
660 ret = dsa_of_setup_routing_table(pd, cd, 651 ret = dsa_of_setup_routing_table(pd, cd,
661 chip_index, link); 652 chip_index, port_index, link);
662 if (ret) 653 if (ret)
663 goto out_free_chip; 654 goto out_free_chip;
664 } 655 }