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 networking fixes from David Miller:

1) GRE tunnel drivers don't set the transport header properly, they also
   blindly deref the inner protocol ipv4 and needs some checks.  Fixes
   from Isaku Yamahata.

2) Fix sleeps while atomic in netdevice rename code, from Eric Dumazet.

3) Fix double-spinlock in solos-pci driver, from Dan Carpenter.

4) More ARP bug fixes.  Fix lockdep splat in arp_solicit() and then the
   bug accidentally added by that fix.  From Eric Dumazet and Cong Wang.

5) Remove some __dev* annotations that slipped back in, as well as all
   HOTPLUG references.  From Greg KH

6) RDS protocol uses wrong interfaces to access scatter-gather elements,
   causing a regression.  From Mike Marciniszyn.

7) Fix build error in cpts driver, from Richard Cochran.

8) Fix arithmetic in packet scheduler, from Stefan Hasko.

9) Similarly, fix association during calculation of random backoff in
   batman-adv.  From Akinobu Mita.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (21 commits)
  ipv6/ip6_gre: set transport header correctly
  ipv4/ip_gre: set transport header correctly to gre header
  IB/rds: suppress incompatible protocol when version is known
  IB/rds: Correct ib_api use with gs_dma_address/sg_dma_len
  net/vxlan: Use the underlying device index when joining/leaving multicast groups
  tcp: should drop incoming frames without ACK flag set
  netprio_cgroup: define sk_cgrp_prioidx only if NETPRIO_CGROUP is enabled
  cpts: fix a run time warn_on.
  cpts: fix build error by removing useless code.
  batman-adv: fix random jitter calculation
  arp: fix a regression in arp_solicit()
  net: sched: integer overflow fix
  CONFIG_HOTPLUG removal from networking core
  Drivers: network: more __dev* removal
  bridge: call br_netpoll_disable in br_add_if
  ipv4: arp: fix a lockdep splat in arp_solicit()
  tuntap: dont use a private kmem_cache
  net: devnet_rename_seq should be a seqcount
  ip_gre: fix possible use after free
  ip_gre: make ipgre_tunnel_xmit() not parse network header as IP unconditionally
  ...
  • Loading branch information
Linus Torvalds committed Dec 27, 2012
2 parents ad4b3fb + ae782bb commit 7fd83b4
Show file tree
Hide file tree
Showing 24 changed files with 78 additions and 98 deletions.
2 changes: 1 addition & 1 deletion drivers/atm/solos-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr
} else {
count = -EINVAL;
}
spin_lock_irq(&card->param_queue_lock);
spin_unlock_irq(&card->param_queue_lock);
return count;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/marvell/mvmdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)
return 0;
}

static int __devinit orion_mdio_probe(struct platform_device *pdev)
static int orion_mdio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct mii_bus *bus;
Expand Down Expand Up @@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)
return 0;
}

static int __devexit orion_mdio_remove(struct platform_device *pdev)
static int orion_mdio_remove(struct platform_device *pdev)
{
struct mii_bus *bus = platform_get_drvdata(pdev);
mdiobus_unregister(bus);
Expand All @@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);

static struct platform_driver orion_mdio_driver = {
.probe = orion_mdio_probe,
.remove = __devexit_p(orion_mdio_remove),
.remove = orion_mdio_remove,
.driver = {
.name = "orion-mdio",
.of_match_table = orion_mdio_match,
Expand Down
19 changes: 9 additions & 10 deletions drivers/net/ethernet/marvell/mvneta.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,


/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
{
u32 val;

Expand All @@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
}

/* Config SGMII port */
static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp)
static void mvneta_port_sgmii_config(struct mvneta_port *pp)
{
u32 val;

Expand Down Expand Up @@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
};

/* Initialize hw */
static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr)
static int mvneta_init(struct mvneta_port *pp, int phy_addr)
{
int queue;

Expand Down Expand Up @@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)
}

/* platform glue : initialize decoding windows */
static void __devinit
mvneta_conf_mbus_windows(struct mvneta_port *pp,
const struct mbus_dram_target_info *dram)
static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
const struct mbus_dram_target_info *dram)
{
u32 win_enable;
u32 win_protect;
Expand Down Expand Up @@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,
}

/* Power up the port */
static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
{
u32 val;

Expand All @@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
}

/* Device initialization routine */
static int __devinit mvneta_probe(struct platform_device *pdev)
static int mvneta_probe(struct platform_device *pdev)
{
const struct mbus_dram_target_info *dram_target_info;
struct device_node *dn = pdev->dev.of_node;
Expand Down Expand Up @@ -2803,7 +2802,7 @@ static int __devinit mvneta_probe(struct platform_device *pdev)
}

/* Device removal routine */
static int __devexit mvneta_remove(struct platform_device *pdev)
static int mvneta_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct mvneta_port *pp = netdev_priv(dev);
Expand All @@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);

static struct platform_driver mvneta_driver = {
.probe = mvneta_probe,
.remove = __devexit_p(mvneta_remove),
.remove = mvneta_remove,
.driver = {
.name = MVNETA_DRIVER_NAME,
.of_match_table = mvneta_match,
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/ti/cpts.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)
cpts->refclk = NULL;
return;
}
clk_enable(cpts->refclk);
cpts->freq = cpts->refclk->recalc(cpts->refclk);
clk_prepare_enable(cpts->refclk);
}

static void cpts_clk_release(struct cpts *cpts)
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/ti/cpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ struct cpts {
struct delayed_work overflow_work;
int phc_index;
struct clk *refclk;
unsigned long freq;
struct list_head events;
struct list_head pool;
struct cpts_event pool_data[CPTS_MAX_EVENTS];
Expand Down
24 changes: 3 additions & 21 deletions drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ struct tun_struct {
int debug;
#endif
spinlock_t lock;
struct kmem_cache *flow_cache;
struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
struct timer_list flow_gc_timer;
unsigned long ageing_time;
Expand Down Expand Up @@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
struct hlist_head *head,
u32 rxhash, u16 queue_index)
{
struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache,
GFP_ATOMIC);
struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);

if (e) {
tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",
rxhash, queue_index);
Expand All @@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
return e;
}

static void tun_flow_free(struct rcu_head *head)
{
struct tun_flow_entry *e
= container_of(head, struct tun_flow_entry, rcu);
kmem_cache_free(e->tun->flow_cache, e);
}

static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)
{
tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",
e->rxhash, e->queue_index);
hlist_del_rcu(&e->hash_link);
call_rcu(&e->rcu, tun_flow_free);
kfree_rcu(e, rcu);
}

static void tun_flow_flush(struct tun_struct *tun)
Expand Down Expand Up @@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun)
{
int i;

tun->flow_cache = kmem_cache_create("tun_flow_cache",
sizeof(struct tun_flow_entry), 0, 0,
NULL);
if (!tun->flow_cache)
return -ENOMEM;

for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)
INIT_HLIST_HEAD(&tun->flows[i]);

Expand All @@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun)
{
del_timer_sync(&tun->flow_gc_timer);
tun_flow_flush(tun);

/* Wait for completion of call_rcu()'s */
rcu_barrier();
kmem_cache_destroy(tun->flow_cache);
}

/* Initialize net device. */
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)
struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
struct sock *sk = vn->sock->sk;
struct ip_mreqn mreq = {
.imr_multiaddr.s_addr = vxlan->gaddr,
.imr_multiaddr.s_addr = vxlan->gaddr,
.imr_ifindex = vxlan->link,
};
int err;

Expand All @@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)
int err = 0;
struct sock *sk = vn->sock->sk;
struct ip_mreqn mreq = {
.imr_multiaddr.s_addr = vxlan->gaddr,
.imr_multiaddr.s_addr = vxlan->gaddr,
.imr_ifindex = vxlan->link,
};

/* Only leave group when last vxlan is done. */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
};

static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = {
static struct pci_device_id rtl8723ae_pci_ids[] = {
{RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},
{},
};
Expand Down
2 changes: 1 addition & 1 deletion include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);

extern rwlock_t dev_base_lock; /* Device list lock */

extern seqlock_t devnet_rename_seq; /* Device rename lock */
extern seqcount_t devnet_rename_seq; /* Device rename seq */


#define for_each_netdev(net, d) \
Expand Down
2 changes: 1 addition & 1 deletion include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ struct sock {
unsigned short sk_ack_backlog;
unsigned short sk_max_ack_backlog;
__u32 sk_priority;
#ifdef CONFIG_CGROUPS
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
__u32 sk_cgrp_prioidx;
#endif
struct pid *sk_peer_pid;
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
unsigned int msecs;

msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
msecs += (random32() % 2 * BATADV_JITTER);
msecs += random32() % (2 * BATADV_JITTER);

return jiffies + msecs_to_jiffies(msecs);
}
Expand Down
8 changes: 5 additions & 3 deletions net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)

err = netdev_set_master(dev, br->dev);
if (err)
goto err3;
goto err4;

err = netdev_rx_handler_register(dev, br_handle_frame, p);
if (err)
goto err4;
goto err5;

dev->priv_flags |= IFF_BRIDGE_PORT;

Expand Down Expand Up @@ -402,8 +402,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)

return 0;

err4:
err5:
netdev_set_master(dev, NULL);
err4:
br_netpoll_disable(p);
err3:
sysfs_remove_link(br->ifobj, p->dev->name);
err2:
Expand Down
18 changes: 9 additions & 9 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static struct list_head offload_base __read_mostly;
DEFINE_RWLOCK(dev_base_lock);
EXPORT_SYMBOL(dev_base_lock);

DEFINE_SEQLOCK(devnet_rename_seq);
seqcount_t devnet_rename_seq;

static inline void dev_base_seq_inc(struct net *net)
{
Expand Down Expand Up @@ -1093,30 +1093,30 @@ int dev_change_name(struct net_device *dev, const char *newname)
if (dev->flags & IFF_UP)
return -EBUSY;

write_seqlock(&devnet_rename_seq);
write_seqcount_begin(&devnet_rename_seq);

if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
write_sequnlock(&devnet_rename_seq);
write_seqcount_end(&devnet_rename_seq);
return 0;
}

memcpy(oldname, dev->name, IFNAMSIZ);

err = dev_get_valid_name(net, dev, newname);
if (err < 0) {
write_sequnlock(&devnet_rename_seq);
write_seqcount_end(&devnet_rename_seq);
return err;
}

rollback:
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
write_sequnlock(&devnet_rename_seq);
write_seqcount_end(&devnet_rename_seq);
return ret;
}

write_sequnlock(&devnet_rename_seq);
write_seqcount_end(&devnet_rename_seq);

write_lock_bh(&dev_base_lock);
hlist_del_rcu(&dev->name_hlist);
Expand All @@ -1135,7 +1135,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
/* err >= 0 after dev_alloc_name() or stores the first errno */
if (err >= 0) {
err = ret;
write_seqlock(&devnet_rename_seq);
write_seqcount_begin(&devnet_rename_seq);
memcpy(dev->name, oldname, IFNAMSIZ);
goto rollback;
} else {
Expand Down Expand Up @@ -4180,7 +4180,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
return -EFAULT;

retry:
seq = read_seqbegin(&devnet_rename_seq);
seq = read_seqcount_begin(&devnet_rename_seq);
rcu_read_lock();
dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);
if (!dev) {
Expand All @@ -4190,7 +4190,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)

strcpy(ifr.ifr_name, dev->name);
rcu_read_unlock();
if (read_seqretry(&devnet_rename_seq, seq))
if (read_seqcount_retry(&devnet_rename_seq, seq))
goto retry;

if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
Expand Down
4 changes: 0 additions & 4 deletions net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,6 @@ struct kobj_ns_type_operations net_ns_type_operations = {
};
EXPORT_SYMBOL_GPL(net_ns_type_operations);

#ifdef CONFIG_HOTPLUG
static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
{
struct net_device *dev = to_net_dev(d);
Expand All @@ -1353,7 +1352,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
exit:
return retval;
}
#endif

/*
* netdev_release -- destroy and free a dead device.
Expand Down Expand Up @@ -1382,9 +1380,7 @@ static struct class net_class = {
#ifdef CONFIG_SYSFS
.dev_attrs = net_class_attributes,
#endif /* CONFIG_SYSFS */
#ifdef CONFIG_HOTPLUG
.dev_uevent = netdev_uevent,
#endif
.ns_type = &net_ns_type_operations,
.namespace = net_namespace,
};
Expand Down
4 changes: 2 additions & 2 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
goto out;

retry:
seq = read_seqbegin(&devnet_rename_seq);
seq = read_seqcount_begin(&devnet_rename_seq);
rcu_read_lock();
dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
ret = -ENODEV;
Expand All @@ -594,7 +594,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,

strcpy(devname, dev->name);
rcu_read_unlock();
if (read_seqretry(&devnet_rename_seq, seq))
if (read_seqcount_retry(&devnet_rename_seq, seq))
goto retry;

len = strlen(devname) + 1;
Expand Down
Loading

0 comments on commit 7fd83b4

Please sign in to comment.