Commit 6672d90f authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David S Miller:

 1) Netfilter xt_limit module can use uninitialized rules, from Jan
    Engelhardt.

 2) Wei Yongjun has found several more spots where error pointers were
    treated as NULL/non-NULL and vice versa.

 3) bnx2x was converted to pci_io{,un}map() but one remaining plain
    iounmap() got missed.  From Neil Horman.

 4) Due to a fence-post type error in initialization of inetpeer entries
    (which is where we store the ICMP rate limiting information), we can
    erroneously drop ICMPs if the inetpeer was created right around when
    jiffies wraps.

    Fix from Nicolas Dichtel.

 5) smsc75xx resume fix from Steve Glendinnig.

 6) LAN87xx smsc chips need an explicit hardware init, from Marek Vasut.

 7) qlcnic uses msleep() with locks held, fix from Narendra K.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
  netdev: octeon: fix return value check in octeon_mgmt_init_phy()
  inetpeer: fix token initialization
  qlcnic: Fix scheduling while atomic bug
  bnx2: Clean up remaining iounmap
  net: phy: smsc: Implement PHY config_init for LAN87xx
  smsc75xx: fix resume after device reset
  netdev: pasemi: fix return value check in pasemi_mac_phy_init()
  team: fix return value check
  l2tp: fix return value check
  netfilter: xt_limit: have r->cost != 0 case work
parents 7596824e df555b66
...@@ -8564,7 +8564,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -8564,7 +8564,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
error: error:
iounmap(bp->regview); pci_iounmap(pdev, bp->regview);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
......
...@@ -722,10 +722,8 @@ static int octeon_mgmt_init_phy(struct net_device *netdev) ...@@ -722,10 +722,8 @@ static int octeon_mgmt_init_phy(struct net_device *netdev)
octeon_mgmt_adjust_link, 0, octeon_mgmt_adjust_link, 0,
PHY_INTERFACE_MODE_MII); PHY_INTERFACE_MODE_MII);
if (IS_ERR(p->phydev)) { if (!p->phydev)
p->phydev = NULL;
return -1; return -1;
}
phy_start_aneg(p->phydev); phy_start_aneg(p->phydev);
......
...@@ -1101,9 +1101,9 @@ static int pasemi_mac_phy_init(struct net_device *dev) ...@@ -1101,9 +1101,9 @@ static int pasemi_mac_phy_init(struct net_device *dev)
phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0,
PHY_INTERFACE_MODE_SGMII); PHY_INTERFACE_MODE_SGMII);
if (IS_ERR(phydev)) { if (!phydev) {
printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); printk(KERN_ERR "%s: Could not attach to phy\n", dev->name);
return PTR_ERR(phydev); return -ENODEV;
} }
mac->phydev = phydev; mac->phydev = phydev;
......
...@@ -15,7 +15,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) ...@@ -15,7 +15,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter)
do { do {
/* give atleast 1ms for firmware to respond */ /* give atleast 1ms for firmware to respond */
msleep(1); mdelay(1);
if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT)
return QLCNIC_CDRP_RSP_TIMEOUT; return QLCNIC_CDRP_RSP_TIMEOUT;
...@@ -601,7 +601,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) ...@@ -601,7 +601,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter)
qlcnic_fw_cmd_destroy_tx_ctx(adapter); qlcnic_fw_cmd_destroy_tx_ctx(adapter);
/* Allow dma queues to drain after context reset */ /* Allow dma queues to drain after context reset */
msleep(20); mdelay(20);
} }
} }
......
...@@ -56,6 +56,32 @@ static int smsc_phy_config_init(struct phy_device *phydev) ...@@ -56,6 +56,32 @@ static int smsc_phy_config_init(struct phy_device *phydev)
return smsc_phy_ack_interrupt (phydev); return smsc_phy_ack_interrupt (phydev);
} }
static int lan87xx_config_init(struct phy_device *phydev)
{
/*
* Make sure the EDPWRDOWN bit is NOT set. Setting this bit on
* LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due
* to a bug on the chip.
*
* When the system is powered on with the network cable being
* disconnected all the way until after ifconfig ethX up is
* issued for the LAN port with this PHY, connecting the cable
* afterwards does not cause LINK change detection, while the
* expected behavior is the Link UP being detected.
*/
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
if (rc < 0)
return rc;
rc &= ~MII_LAN83C185_EDPWRDOWN;
rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc);
if (rc < 0)
return rc;
return smsc_phy_ack_interrupt(phydev);
}
static int lan911x_config_init(struct phy_device *phydev) static int lan911x_config_init(struct phy_device *phydev)
{ {
return smsc_phy_ack_interrupt(phydev); return smsc_phy_ack_interrupt(phydev);
...@@ -162,7 +188,7 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -162,7 +188,7 @@ static struct phy_driver smsc_phy_driver[] = {
/* basic functions */ /* basic functions */
.config_aneg = genphy_config_aneg, .config_aneg = genphy_config_aneg,
.read_status = genphy_read_status, .read_status = genphy_read_status,
.config_init = smsc_phy_config_init, .config_init = lan87xx_config_init,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt, .ack_interrupt = smsc_phy_ack_interrupt,
......
...@@ -1653,8 +1653,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) ...@@ -1653,8 +1653,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
&team_nl_family, 0, TEAM_CMD_NOOP); &team_nl_family, 0, TEAM_CMD_NOOP);
if (IS_ERR(hdr)) { if (!hdr) {
err = PTR_ERR(hdr); err = -EMSGSIZE;
goto err_msg_put; goto err_msg_put;
} }
...@@ -1848,8 +1848,8 @@ static int team_nl_send_options_get(struct team *team, u32 pid, u32 seq, ...@@ -1848,8 +1848,8 @@ static int team_nl_send_options_get(struct team *team, u32 pid, u32 seq,
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI, hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI,
TEAM_CMD_OPTIONS_GET); TEAM_CMD_OPTIONS_GET);
if (IS_ERR(hdr)) if (!hdr)
return PTR_ERR(hdr); return -EMSGSIZE;
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
goto nla_put_failure; goto nla_put_failure;
...@@ -2068,8 +2068,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb, ...@@ -2068,8 +2068,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb,
hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags, hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags,
TEAM_CMD_PORT_LIST_GET); TEAM_CMD_PORT_LIST_GET);
if (IS_ERR(hdr)) if (!hdr)
return PTR_ERR(hdr); return -EMSGSIZE;
if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
goto nla_put_failure; goto nla_put_failure;
......
...@@ -1253,6 +1253,7 @@ static struct usb_driver smsc75xx_driver = { ...@@ -1253,6 +1253,7 @@ static struct usb_driver smsc75xx_driver = {
.probe = usbnet_probe, .probe = usbnet_probe,
.suspend = usbnet_suspend, .suspend = usbnet_suspend,
.resume = usbnet_resume, .resume = usbnet_resume,
.reset_resume = usbnet_resume,
.disconnect = usbnet_disconnect, .disconnect = usbnet_disconnect,
.disable_hub_initiated_lpm = 1, .disable_hub_initiated_lpm = 1,
}; };
......
...@@ -510,7 +510,10 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, ...@@ -510,7 +510,10 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
secure_ipv6_id(daddr->addr.a6)); secure_ipv6_id(daddr->addr.a6));
p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
p->rate_tokens = 0; p->rate_tokens = 0;
p->rate_last = 0; /* 60*HZ is arbitrary, but chosen enough high so that the first
* calculation of tokens is at its maximum.
*/
p->rate_last = jiffies - 60*HZ;
INIT_LIST_HEAD(&p->gc_list); INIT_LIST_HEAD(&p->gc_list);
/* Link the node. */ /* Link the node. */
......
...@@ -80,8 +80,8 @@ static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) ...@@ -80,8 +80,8 @@ static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
&l2tp_nl_family, 0, L2TP_CMD_NOOP); &l2tp_nl_family, 0, L2TP_CMD_NOOP);
if (IS_ERR(hdr)) { if (!hdr) {
ret = PTR_ERR(hdr); ret = -EMSGSIZE;
goto err_out; goto err_out;
} }
...@@ -250,8 +250,8 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 pid, u32 seq, int flags, ...@@ -250,8 +250,8 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 pid, u32 seq, int flags,
hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags,
L2TP_CMD_TUNNEL_GET); L2TP_CMD_TUNNEL_GET);
if (IS_ERR(hdr)) if (!hdr)
return PTR_ERR(hdr); return -EMSGSIZE;
if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) || if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) ||
nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) ||
...@@ -617,8 +617,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 pid, u32 seq, int flags ...@@ -617,8 +617,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 pid, u32 seq, int flags
sk = tunnel->sock; sk = tunnel->sock;
hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, L2TP_CMD_SESSION_GET); hdr = genlmsg_put(skb, pid, seq, &l2tp_nl_family, flags, L2TP_CMD_SESSION_GET);
if (IS_ERR(hdr)) if (!hdr)
return PTR_ERR(hdr); return -EMSGSIZE;
if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) ||
nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) || nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) ||
......
...@@ -117,11 +117,11 @@ static int limit_mt_check(const struct xt_mtchk_param *par) ...@@ -117,11 +117,11 @@ static int limit_mt_check(const struct xt_mtchk_param *par)
/* For SMP, we only want to use one set of state. */ /* For SMP, we only want to use one set of state. */
r->master = priv; r->master = priv;
/* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies *
128. */
priv->prev = jiffies;
priv->credit = user2credits(r->avg * r->burst); /* Credits full. */
if (r->cost == 0) { if (r->cost == 0) {
/* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies *
128. */
priv->prev = jiffies;
priv->credit = user2credits(r->avg * r->burst); /* Credits full. */
r->credit_cap = priv->credit; /* Credits full. */ r->credit_cap = priv->credit; /* Credits full. */
r->cost = user2credits(r->avg); r->cost = user2credits(r->avg);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment