[PATCH 1/5] net/tap: fix net_init_tap(): set ret on failure path

Vladimir Sementsov-Ogievskiy posted 5 patches 4 years, 11 months ago
Maintainers: Jason Wang <jasowang@redhat.com>
[PATCH 1/5] net/tap: fix net_init_tap(): set ret on failure path
Posted by Vladimir Sementsov-Ogievskiy 4 years, 11 months ago
We should set ret to -1 on this failure path.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 net/tap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tap.c b/net/tap.c
index b7512853f4..75b01d54ee 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -880,6 +880,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
             if (i == 0) {
                 vnet_hdr = tap_probe_vnet_hdr(fd, errp);
                 if (vnet_hdr < 0) {
+                    ret = -1;
                     goto free_fail;
                 }
             } else if (vnet_hdr != tap_probe_vnet_hdr(fd, NULL)) {
-- 
2.28.0