mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
vxlan: check return value of gro_cells_init()
[ Upstream commit384d91c267
] gro_cells_init() returns error if memory allocation is failed. But the vxlan module doesn't check the return value of gro_cells_init(). Fixes:58ce31cca1
("vxlan: GRO support at tunnel layer")` Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bee69eac47
commit
b200a210a6
1 changed files with 9 additions and 2 deletions
|
@ -2454,10 +2454,19 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
|
||||||
/* Setup stats when device is created */
|
/* Setup stats when device is created */
|
||||||
static int vxlan_init(struct net_device *dev)
|
static int vxlan_init(struct net_device *dev)
|
||||||
{
|
{
|
||||||
|
struct vxlan_dev *vxlan = netdev_priv(dev);
|
||||||
|
int err;
|
||||||
|
|
||||||
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
|
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
|
||||||
if (!dev->tstats)
|
if (!dev->tstats)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
err = gro_cells_init(&vxlan->gro_cells, dev);
|
||||||
|
if (err) {
|
||||||
|
free_percpu(dev->tstats);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2717,8 +2726,6 @@ static void vxlan_setup(struct net_device *dev)
|
||||||
|
|
||||||
vxlan->dev = dev;
|
vxlan->dev = dev;
|
||||||
|
|
||||||
gro_cells_init(&vxlan->gro_cells, dev);
|
|
||||||
|
|
||||||
for (h = 0; h < FDB_HASH_SIZE; ++h)
|
for (h = 0; h < FDB_HASH_SIZE; ++h)
|
||||||
INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
|
INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue