package/dropbear: fix segfault with remote port forwarding (closes: #10339)
[openwrt.git] / target / linux / lantiq / patches-3.0 / 800-fix-etop.patch
1 Index: linux-3.0.3/drivers/net/lantiq_etop.c
2 ===================================================================
3 --- linux-3.0.3.orig/drivers/net/lantiq_etop.c  2011-10-07 11:03:00.140000754 +0200
4 +++ linux-3.0.3/drivers/net/lantiq_etop.c       2011-10-07 11:03:06.088001008 +0200
5 @@ -397,7 +397,10 @@
6  {
7         struct ltq_etop_priv *priv = netdev_priv(dev);
8  
9 -       return phy_ethtool_gset(priv->phydev, cmd);
10 +       if (priv->phydev)
11 +               return phy_ethtool_gset(priv->phydev, cmd);
12 +       else
13 +               return 0;
14  }
15  
16  static int
17 @@ -405,7 +408,10 @@
18  {
19         struct ltq_etop_priv *priv = netdev_priv(dev);
20  
21 -       return phy_ethtool_sset(priv->phydev, cmd);
22 +       if (priv->phydev)
23 +               return phy_ethtool_sset(priv->phydev, cmd);
24 +       else
25 +               return 0;
26  }
27  
28  static int
29 @@ -413,7 +419,10 @@
30  {
31         struct ltq_etop_priv *priv = netdev_priv(dev);
32  
33 -       return phy_start_aneg(priv->phydev);
34 +       if (priv->phydev)
35 +               return phy_start_aneg(priv->phydev);
36 +       else
37 +               return 0;
38  }
39  
40  static const struct ethtool_ops ltq_etop_ethtool_ops = {
41 @@ -615,7 +624,8 @@
42                 ltq_dma_open(&ch->dma);
43                 napi_enable(&ch->napi);
44         }
45 -       phy_start(priv->phydev);
46 +       if (priv->phydev)
47 +               phy_start(priv->phydev);
48         netif_tx_start_all_queues(dev);
49         return 0;
50  }
51 @@ -627,7 +637,8 @@
52         int i;
53  
54         netif_tx_stop_all_queues(dev);
55 -       phy_stop(priv->phydev);
56 +       if (priv->phydev)
57 +               phy_stop(priv->phydev);
58         for (i = 0; i < MAX_DMA_CHAN; i++) {
59                 struct ltq_etop_chan *ch = &priv->ch[i];
60  
61 @@ -775,7 +786,7 @@
62         ltq_etop_set_multicast_list(dev);
63         err = ltq_etop_mdio_init(dev);
64         if (err)
65 -               goto err_netdev;
66 +               pr_warn("etop: mdio probe failed\n");;
67         return 0;
68  
69  err_netdev: