Skip to content

Commit 384d91c

Browse files
TaeheeYoodavem330
authored andcommitted
vxlan: check return value of gro_cells_init()
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: 58ce31c ("vxlan: GRO support at tunnel layer")` Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dd2af10 commit 384d91c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎drivers/net/vxlan.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,10 +2779,19 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
27792779
/* Setup stats when device is created */
27802780
static int vxlan_init(struct net_device *dev)
27812781
{
2782+
struct vxlan_dev *vxlan = netdev_priv(dev);
2783+
int err;
2784+
27822785
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
27832786
if (!dev->tstats)
27842787
return -ENOMEM;
27852788

2789+
err = gro_cells_init(&vxlan->gro_cells, dev);
2790+
if (err) {
2791+
free_percpu(dev->tstats);
2792+
return err;
2793+
}
2794+
27862795
return 0;
27872796
}
27882797

@@ -3043,8 +3052,6 @@ static void vxlan_setup(struct net_device *dev)
30433052

30443053
vxlan->dev = dev;
30453054

3046-
gro_cells_init(&vxlan->gro_cells, dev);
3047-
30483055
for (h = 0; h < FDB_HASH_SIZE; ++h) {
30493056
spin_lock_init(&vxlan->hash_lock[h]);
30503057
INIT_HLIST_HEAD(&vxlan->fdb_head[h]);

0 commit comments

Comments
 (0)