fix a panic when passing ifioctl from a netmap file descriptor to
the underlying device. This needs to be merged to 10.1 Reported by: Patrick Kelsey MFC after: 3 days
This commit is contained in:
parent
7f154b713a
commit
b3d3758852
@ -2222,23 +2222,18 @@ netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
|
||||
|
||||
default: /* allow device-specific ioctls */
|
||||
{
|
||||
struct socket so;
|
||||
struct ifnet *ifp;
|
||||
struct ifnet *ifp = ifunit_ref(nmr->nr_name);
|
||||
if (ifp == NULL) {
|
||||
error = ENXIO;
|
||||
} else {
|
||||
struct socket so;
|
||||
|
||||
bzero(&so, sizeof(so));
|
||||
NMG_LOCK();
|
||||
error = netmap_get_na(nmr, &na, 0 /* don't create */); /* keep reference */
|
||||
if (error) {
|
||||
netmap_adapter_put(na);
|
||||
NMG_UNLOCK();
|
||||
break;
|
||||
bzero(&so, sizeof(so));
|
||||
so.so_vnet = ifp->if_vnet;
|
||||
// so->so_proto not null.
|
||||
error = ifioctl(&so, cmd, data, td);
|
||||
if_rele(ifp);
|
||||
}
|
||||
ifp = na->ifp;
|
||||
so.so_vnet = ifp->if_vnet;
|
||||
// so->so_proto not null.
|
||||
error = ifioctl(&so, cmd, data, td);
|
||||
netmap_adapter_put(na);
|
||||
NMG_UNLOCK();
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user