Message ID | 20231018110917.4131-1-abelova@astralinux.ru |
---|---|
State | New |
Headers | show |
Series | l2tpv3: overwrite s->fd in net_l2tpv3_cleanup | expand |
18/10/23 14:09, Anastasia Belova: > It's better to overwrite freed pointer s->fd to avoid accessing an > invalid descriptor. Found by Linux Verification Center > (linuxtesting.org) with SVACE. Just a friendly reminder. Anastasia Belova
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);
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 <abelova@astralinux.ru> --- net/l2tpv3.c | 1 + 1 file changed, 1 insertion(+)