loader: net_open() should not replace f->f_devdata
authorToomas Soome <tsoome@FreeBSD.org>
Fri, 24 Sep 2021 15:04:31 +0000 (18:04 +0300)
committerToomas Soome <tsoome@FreeBSD.org>
Tue, 19 Oct 2021 16:43:56 +0000 (19:43 +0300)
commit98e805b4a18d6ef4d3c9924166e1217e0430290d
treea788364cea76f07a5575078fe8ccb4faccf98162
parentbcd4c17ccaacf995224882dc1d05e2a51867bdf2
loader: net_open() should not replace f->f_devdata

net_open() does replace f_devdata with pointer to netdev_sock,
this will cause memory leak when device is closed, but also does
alter the devopen() logic.

We should store &netdev_sock to dev->d_opendata instead, this
would preserve and follow the devopen() logic.

Fixes network boot on aarch64 (tested by bz).

Reviewed-by: imp
MFC After: 2 weeks
Differential Revision: https://reviews.freebsd.org/D32227
stand/common/dev_net.c
stand/libsa/nfs.c
stand/libsa/tftp.c