Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
Pull more networking updates from David Miller:

 1) If a VXLAN interface is created with no groups, we can crash on
    reception of packets.  Fix from Mike Rapoport.

 2) Missing includes in CPTS driver, from Alexei Starovoitov.

 3) Fix string validations in isdnloop driver, from YOSHIFUJI Hideaki
    and Dan Carpenter.

 4) Missing irq.h include in bnxw2x, enic, and qlcnic drivers.  From
    Josh Boyer.

 5) AF_PACKET transmit doesn't statistically count TX drops, from Daniel
    Borkmann.

 6) Byte-Queue-Limit enabled drivers aren't handled properly in
    AF_PACKET transmit path, also from Daniel Borkmann.

    Same problem exists in pktgen, and Daniel fixed it there too.

 7) Fix resource leaks in driver probe error paths of new sxgbe driver,
    from Francois Romieu.

 8) Truesize of SKBs can gradually get more and more corrupted in NAPI
    packet recycling path, fix from Eric Dumazet.

 9) Fix uniprocessor netfilter build, from Florian Westphal.  In the
    longer term we should perhaps try to find a way for ARRAY_SIZE() to
    work even with zero sized array elements.

10) Fix crash in netfilter conntrack extensions due to mis-estimation of
    required extension space.  From Andrey Vagin.

11) Since we commit table rule updates before trying to copy the
    counters back to userspace (it's the last action we perform), we
    really can't signal the user copy with an error as we are beyond the
    point from which we can unwind everything.  This causes all kinds of
    use after free crashes and other mysterious behavior.

    From Thomas Graf.

12) Restore previous behvaior of div/mod by zero in BPF filter
    processing.  From Daniel Borkmann.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (38 commits)
  net: sctp: wake up all assocs if sndbuf policy is per socket
  isdnloop: several buffer overflows
  netdev: remove potentially harmful checks
  pktgen: fix xmit test for BQL enabled devices
  net/at91_ether: avoid NULL pointer dereference
  tipc: Let tipc_release() return 0
  at86rf230: fix MAX_CSMA_RETRIES parameter
  mac802154: fix duplicate #include headers
  sxgbe: fix duplicate #include headers
  net: filter: be more defensive on div/mod by X==0
  netfilter: Can't fail and free after table replacement
  xen-netback: Trivial format string fix
  net: bcmgenet: Remove unnecessary version.h inclusion
  net: smc911x: Remove unused local variable
  bonding: Inactive slaves should keep inactive flag's value
  netfilter: nf_tables: fix wrong format in request_module()
  netfilter: nf_tables: set names cannot be larger than 15 bytes
  netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len
  netfilter: Add {ipt,ip6t}_osf aliases for xt_osf
  netfilter: x_tables: allow to use cgroup match for LOCAL_IN nf hooks
  ...
  • Loading branch information
Linus Torvalds committed Apr 8, 2014
2 parents 0afccc4 + 52c35be commit ce7613d
Show file tree
Hide file tree
Showing 38 changed files with 320 additions and 168 deletions.
23 changes: 15 additions & 8 deletions drivers/isdn/isdnloop/isdnloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,9 @@ static isdnloop_stat isdnloop_cmd_table[] =
static void
isdnloop_fake_err(isdnloop_card *card)
{
char buf[60];
char buf[64];

sprintf(buf, "E%s", card->omsg);
snprintf(buf, sizeof(buf), "E%s", card->omsg);
isdnloop_fake(card, buf, -1);
isdnloop_fake(card, "NAK", -1);
}
Expand Down Expand Up @@ -903,6 +903,8 @@ isdnloop_parse_cmd(isdnloop_card *card)
case 7:
/* 0x;EAZ */
p += 3;
if (strlen(p) >= sizeof(card->eazlist[0]))
break;
strcpy(card->eazlist[ch - 1], p);
break;
case 8:
Expand Down Expand Up @@ -1070,6 +1072,12 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
return -EBUSY;
if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
return -EFAULT;

for (i = 0; i < 3; i++) {
if (!memchr(sdef.num[i], 0, sizeof(sdef.num[i])))
return -EINVAL;
}

spin_lock_irqsave(&card->isdnloop_lock, flags);
switch (sdef.ptype) {
case ISDN_PTYPE_EURO:
Expand Down Expand Up @@ -1127,7 +1135,7 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
{
ulong a;
int i;
char cbuf[60];
char cbuf[80];
isdn_ctrl cmd;
isdnloop_cdef cdef;

Expand Down Expand Up @@ -1192,7 +1200,6 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
break;
if ((c->arg & 255) < ISDNLOOP_BCH) {
char *p;
char dial[50];
char dcode[4];

a = c->arg;
Expand All @@ -1204,10 +1211,10 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
} else
/* Normal Dial */
strcpy(dcode, "CAL");
strcpy(dial, p);
sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
dcode, dial, c->parm.setup.si1,
c->parm.setup.si2, c->parm.setup.eazmsn);
snprintf(cbuf, sizeof(cbuf),
"%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
dcode, p, c->parm.setup.si1,
c->parm.setup.si2, c->parm.setup.eazmsn);
i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3077,7 +3077,7 @@ static int bond_open(struct net_device *bond_dev)
if (bond_has_slaves(bond)) {
read_lock(&bond->curr_slave_lock);
bond_for_each_slave(bond, slave, iter) {
if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP)
if (USES_PRIMARY(bond->params.mode)
&& (slave != bond->curr_active_slave)) {
bond_set_slave_inactive_flags(slave,
BOND_SLAVE_NOTIFY_NOW);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/irq.h>

#include "bnx2x.h"
#include "bnx2x_sriov.h"
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/dma-mapping.h>
#include <linux/pm.h>
#include <linux/clk.h>
#include <linux/version.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/cadence/at91_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ static int __init at91ether_probe(struct platform_device *pdev)
}
clk_enable(lp->pclk);

lp->hclk = ERR_PTR(-ENOENT);
lp->tx_clk = ERR_PTR(-ENOENT);

/* Install the interrupt handler */
dev->irq = platform_get_irq(pdev, 0);
res = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt, 0, dev->name, dev);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/cisco/enic/enic.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "vnic_stats.h"
#include "vnic_nic.h"
#include "vnic_rss.h"
#include <linux/irq.h>

#define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/timer.h>
#include <linux/irq.h>

#include <linux/vmalloc.h>

Expand Down
24 changes: 20 additions & 4 deletions drivers/net/ethernet/samsung/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@
#

config NET_VENDOR_SAMSUNG
bool "Samsung Ethernet device"
bool "Samsung Ethernet devices"
default y
---help---
This is the driver for the SXGBE 10G Ethernet IP block found on Samsung
platforms.
If you have a network (Ethernet) chipset belonging to this class,
say Y.

Note that the answer to this question does not directly affect
the kernel: saying N will just case the configurator to skip all
the questions about Samsung chipsets. If you say Y, you will be asked
for your specific chipset/driver in the following questions.

if NET_VENDOR_SAMSUNG

source "drivers/net/ethernet/samsung/sxgbe/Kconfig"
config SXGBE_ETH
tristate "Samsung 10G/2.5G/1G SXGBE Ethernet driver"
depends on HAS_IOMEM && HAS_DMA
select PHYLIB
select CRC32
select PTP_1588_CLOCK
---help---
This is the driver for the SXGBE 10G Ethernet IP block found on
Samsung platforms.

To compile this driver as a module, choose M here: the module
will be called samsung-sxgbe.

endif # NET_VENDOR_SAMSUNG
9 changes: 0 additions & 9 deletions drivers/net/ethernet/samsung/sxgbe/Kconfig

This file was deleted.

1 change: 0 additions & 1 deletion drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/io.h>
Expand Down
27 changes: 17 additions & 10 deletions drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,11 +2113,11 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
/* allocate memory resources for Descriptor rings */
ret = txring_mem_alloc(priv);
if (ret)
goto error_free_netdev;
goto error_free_hw;

ret = rxring_mem_alloc(priv);
if (ret)
goto error_free_netdev;
goto error_free_hw;

ndev->netdev_ops = &sxgbe_netdev_ops;

Expand Down Expand Up @@ -2163,7 +2163,7 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
if (IS_ERR(priv->sxgbe_clk)) {
netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
__func__);
goto error_clk_get;
goto error_napi_del;
}

/* If a specific clk_csr value is passed from the platform
Expand All @@ -2182,24 +2182,27 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
if (ret < 0) {
netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration failed\n",
__func__, priv->plat->bus_id);
goto error_mdio_register;
goto error_clk_put;
}

ret = register_netdev(ndev);
if (ret) {
pr_err("%s: ERROR %i registering the device\n", __func__, ret);
goto error_netdev_register;
goto error_mdio_unregister;
}

sxgbe_check_ether_addr(priv);

return priv;

error_mdio_register:
error_mdio_unregister:
sxgbe_mdio_unregister(ndev);
error_clk_put:
clk_put(priv->sxgbe_clk);
error_clk_get:
error_netdev_register:
error_napi_del:
netif_napi_del(&priv->napi);
error_free_hw:
kfree(priv->hw);
error_free_netdev:
free_netdev(ndev);

Expand All @@ -2224,11 +2227,15 @@ int sxgbe_drv_remove(struct net_device *ndev)
priv->hw->mac->enable_tx(priv->ioaddr, false);
priv->hw->mac->enable_rx(priv->ioaddr, false);

netif_napi_del(&priv->napi);
unregister_netdev(ndev);

sxgbe_mdio_unregister(ndev);

unregister_netdev(ndev);
clk_put(priv->sxgbe_clk);

netif_napi_del(&priv->napi);

kfree(priv->hw);

free_netdev(ndev);

Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/smsc/smc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,6 @@ static void
smc911x_rx_dma_irq(int dma, void *data)
{
struct net_device *dev = (struct net_device *)data;
unsigned long ioaddr = dev->base_addr;
struct smc911x_local *lp = netdev_priv(dev);
struct sk_buff *skb = lp->current_rx_skb;
unsigned long flags;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/ti/cpts.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <linux/time.h>
#include <linux/uaccess.h>
#include <linux/workqueue.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>

#include "cpts.h"

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ieee802154/at86rf230.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ at86rf212_set_csma_params(struct ieee802154_dev *dev, u8 min_be, u8 max_be,
if (rc)
return rc;

return at86rf230_write_subreg(lp, SR_MAX_CSMA_RETRIES, max_be);
return at86rf230_write_subreg(lp, SR_MAX_CSMA_RETRIES, retries);
}

static int
Expand Down
52 changes: 40 additions & 12 deletions drivers/net/phy/spi_ks8995.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPI driver for Micrel/Kendin KS8995M ethernet switch
* SPI driver for Micrel/Kendin KS8995M and KSZ8864RMN ethernet switches
*
* Copyright (C) 2008 Gabor Juhos <juhosg at openwrt.org>
*
Expand Down Expand Up @@ -70,7 +70,10 @@
#define KS8995_REG_IAD1 0x76 /* Indirect Access Data 1 */
#define KS8995_REG_IAD0 0x77 /* Indirect Access Data 0 */

#define KSZ8864_REG_ID1 0xfe /* Chip ID in bit 7 */

#define KS8995_REGS_SIZE 0x80
#define KSZ8864_REGS_SIZE 0x100

#define ID1_CHIPID_M 0xf
#define ID1_CHIPID_S 4
Expand All @@ -94,6 +97,7 @@ struct ks8995_switch {
struct spi_device *spi;
struct mutex lock;
struct ks8995_pdata *pdata;
struct bin_attribute regs_attr;
};

static inline u8 get_chip_id(u8 val)
Expand Down Expand Up @@ -216,11 +220,11 @@ static ssize_t ks8995_registers_read(struct file *filp, struct kobject *kobj,
dev = container_of(kobj, struct device, kobj);
ks8995 = dev_get_drvdata(dev);

if (unlikely(off > KS8995_REGS_SIZE))
if (unlikely(off > ks8995->regs_attr.size))
return 0;

if ((off + count) > KS8995_REGS_SIZE)
count = KS8995_REGS_SIZE - off;
if ((off + count) > ks8995->regs_attr.size)
count = ks8995->regs_attr.size - off;

if (unlikely(!count))
return count;
Expand All @@ -238,11 +242,11 @@ static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
dev = container_of(kobj, struct device, kobj);
ks8995 = dev_get_drvdata(dev);

if (unlikely(off >= KS8995_REGS_SIZE))
if (unlikely(off >= ks8995->regs_attr.size))
return -EFBIG;

if ((off + count) > KS8995_REGS_SIZE)
count = KS8995_REGS_SIZE - off;
if ((off + count) > ks8995->regs_attr.size)
count = ks8995->regs_attr.size - off;

if (unlikely(!count))
return count;
Expand All @@ -251,7 +255,7 @@ static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
}


static struct bin_attribute ks8995_registers_attr = {
static const struct bin_attribute ks8995_registers_attr = {
.attr = {
.name = "registers",
.mode = S_IRUSR | S_IWUSR,
Expand Down Expand Up @@ -306,20 +310,44 @@ static int ks8995_probe(struct spi_device *spi)
goto err_drvdata;
}

memcpy(&ks->regs_attr, &ks8995_registers_attr, sizeof(ks->regs_attr));
if (get_chip_id(ids[1]) != CHIPID_M) {
u8 val;

/* Check if this is a KSZ8864RMN */
err = ks8995_read(ks, &val, KSZ8864_REG_ID1, sizeof(val));
if (err < 0) {
dev_err(&spi->dev,
"unable to read chip id register, err=%d\n",
err);
goto err_drvdata;
}
if ((val & 0x80) == 0) {
dev_err(&spi->dev, "unknown chip:%02x,0\n", ids[1]);
goto err_drvdata;
}
ks->regs_attr.size = KSZ8864_REGS_SIZE;
}

err = ks8995_reset(ks);
if (err)
goto err_drvdata;

err = sysfs_create_bin_file(&spi->dev.kobj, &ks8995_registers_attr);
err = sysfs_create_bin_file(&spi->dev.kobj, &ks->regs_attr);
if (err) {
dev_err(&spi->dev, "unable to create sysfs file, err=%d\n",
err);
goto err_drvdata;
}

dev_info(&spi->dev, "KS89%02X device found, Chip ID:%01x, "
"Revision:%01x\n", ids[0],
get_chip_id(ids[1]), get_chip_rev(ids[1]));
if (get_chip_id(ids[1]) == CHIPID_M) {
dev_info(&spi->dev,
"KS8995 device found, Chip ID:%x, Revision:%x\n",
get_chip_id(ids[1]), get_chip_rev(ids[1]));
} else {
dev_info(&spi->dev, "KSZ8864 device found, Revision:%x\n",
get_chip_rev(ids[1]));
}

return 0;

Expand Down
Loading

0 comments on commit ce7613d

Please sign in to comment.