[Devel,RHEL7,COMMIT] venet: treat presence of veip object with the same VEID as error

Submitted by Konstantin Khorenko on April 22, 2017, 11:47 a.m.

Details

Message ID 201704221147.v3MBl2un027991@finist_cl7.x64_64.work.ct
State New
Series "Fix VEIP object handling on container destroy"
Headers show

Commit Message

Konstantin Khorenko April 22, 2017, 11:47 a.m.
The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.30.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.30.4
------>
commit 1fb40f5a65abd35823f794928d9c62fda2bc604f
Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Date:   Sat Apr 22 15:47:02 2017 +0400

    venet: treat presence of veip object with the same VEID as error
    
    This shouldn't happen. VEIP object is identified by veid, which is unique per
    VE structure.
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 drivers/net/veip_mgmt.c | 2 ++
 drivers/net/venetdev.c  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/net/veip_mgmt.c b/drivers/net/veip_mgmt.c
index 343ee7d..b45e411 100644
--- a/drivers/net/veip_mgmt.c
+++ b/drivers/net/veip_mgmt.c
@@ -42,6 +42,8 @@  static int veip_create(struct ve_struct *ve)
 	veip = veip_findcreate(ve->veid);
 	if (veip == NULL)
 		return -ENOMEM;
+	if (IS_ERR(veip))
+		return PTR_ERR(veip);
 
 	ve->veip = veip;
 	return 0;
diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index a4388fd..192ca3c 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -221,7 +221,7 @@  struct veip_struct *veip_findcreate(envid_t veid)
 
 	ptr = veip_find(veid);
 	if (ptr != NULL)
-		return ptr;
+		return ERR_PTR(-EEXIST);
 
 	ptr = kmalloc(sizeof(struct veip_struct), GFP_ATOMIC);
 	if (ptr == NULL)