It's better to overwrite freed pointer s->fd to avoid
accessing an invalid descriptor.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 3fb69aa1d1 ("net: L2TPv3 transport")
Signed-off-by: Anastasia Belova <abel...@astralinux.ru>
---
 net/l2tpv3.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index b5547cb917..713fb8053a 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -501,6 +501,7 @@ static void net_l2tpv3_cleanup(NetClientState *nc)
     l2tpv3_write_poll(s, false);
     if (s->fd >= 0) {
         close(s->fd);
+        s->fd = -1;
     }
     destroy_vector(s->msgvec, MAX_L2TPV3_MSGCNT, IOVSIZE);
     g_free(s->vec);
-- 
2.30.2


Reply via email to