|
@@ -611,6 +611,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
|
|
|
struct vxlan_rdst *rd = NULL;
|
|
|
struct vxlan_fdb *f;
|
|
|
int notify = 0;
|
|
|
+ int rc;
|
|
|
|
|
|
f = __vxlan_find_mac(vxlan, mac);
|
|
|
if (f) {
|
|
@@ -641,8 +642,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
|
|
|
if ((flags & NLM_F_APPEND) &&
|
|
|
(is_multicast_ether_addr(f->eth_addr) ||
|
|
|
is_zero_ether_addr(f->eth_addr))) {
|
|
|
- int rc = vxlan_fdb_append(f, ip, port, vni, ifindex,
|
|
|
- &rd);
|
|
|
+ rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
|
|
|
|
|
|
if (rc < 0)
|
|
|
return rc;
|
|
@@ -673,7 +673,11 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
|
|
|
INIT_LIST_HEAD(&f->remotes);
|
|
|
memcpy(f->eth_addr, mac, ETH_ALEN);
|
|
|
|
|
|
- vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
|
|
|
+ rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
|
|
|
+ if (rc < 0) {
|
|
|
+ kfree(f);
|
|
|
+ return rc;
|
|
|
+ }
|
|
|
|
|
|
++vxlan->addrcnt;
|
|
|
hlist_add_head_rcu(&f->hlist,
|