OSF/1 SIOCRPHYSADDR fix
Brooks Davis
brooks at one-eyed-alien.net
Mon Aug 30 01:39:02 PDT 2004
Please review the following diff. I don't expect anyone to actually
have a way to exercise this code, but as it is, it's quite broken. The
patch switches to scanning the interface list by the approved method
instead of trying to access all the indexes between 1 and if_index
as though they all exist. Currently, this means that if you delete
an interface other then the last one, you will attempt to access freed
memory. I'm planning to fix that so you instead hit a NULL pointer
(I've done so in 6-CURRENT already).
-- Brooks
==== //depot/user/brooks/cleanup/sys/alpha/osf1/osf1_ioctl.c#1 - /home/brooks/working/freebsd/p4/cleanup/sys/alpha/osf1/osf1_ioctl.c ====
@@ -201,8 +201,8 @@
* Note that we don't actually respect the name in the ifreq
* structure, as DU interface names are all different.
*/
- for (ifn = 0; ifn < if_index; ifn++) {
- ifp = ifnet_byindex(ifn + 1);
+ IFNET_RLOCK();
+ TAILQ_FOREACH(ifp, &ifnet, if_link) {
/* Only look at ether interfaces, exclude alteon nics
* because osf/1 doesn't know about most of them.
*/
@@ -216,16 +216,17 @@
retval = copyout(LLADDR(sdl),
(caddr_t)&ifd->current_pa,
6);
- if (!retval) {
- return(copyout(
- LLADDR(sdl),
- (caddr_t)&ifd->default_pa,
- 6));
+ if (retval == 0) {
+ retval = copyout(LLADDR(sdl),
+ (caddr_t)&ifd->default_pa, 6);
+ IFNET_RUNLOCK();
+ return(retval);
}
}
}
}
}
+ IFNET_RUNLOCK();
return(ENOENT); /* ??? */
}
--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-alpha/attachments/20040830/fabae829/attachment.bin
More information about the freebsd-alpha
mailing list