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

Konstantin Khorenko khorenko at virtuozzo.com
Sat Apr 22 04:47:02 PDT 2017


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 at 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 at virtuozzo.com>
---
 drivers/net/veip_mgmt.c | 2 ++
 drivers/net/venetdev.c  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

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)


More information about the Devel mailing list