summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2001-09-14 08:04:25 +0000
committermarcel <marcel@FreeBSD.org>2001-09-14 08:04:25 +0000
commitc7273783389ef486b17288ac2c28fa2dc4cbba50 (patch)
tree22be92fdd9e7a4a1cbf07b31bf232d373089e77a
parentb6aaff7afb3a3e36dfed293ee78b59da76e23715 (diff)
downloadFreeBSD-src-c7273783389ef486b17288ac2c28fa2dc4cbba50.zip
FreeBSD-src-c7273783389ef486b17288ac2c28fa2dc4cbba50.tar.gz
Fix off by one error introduced by the use of the ifnet_byindex()
macro. The commit log clearly states that the index given to the macro is one higher than previously used to index the array. This wasn't represented in the code and resulted in kernel page faults. Reported by: Andrew Atrens <atrens@nortelnetworks.com>
-rw-r--r--sys/alpha/osf1/osf1_ioctl.c2
-rw-r--r--sys/compat/linux/linux_ioctl.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/alpha/osf1/osf1_ioctl.c b/sys/alpha/osf1/osf1_ioctl.c
index 5d8916c..1005a72 100644
--- a/sys/alpha/osf1/osf1_ioctl.c
+++ b/sys/alpha/osf1/osf1_ioctl.c
@@ -202,7 +202,7 @@ osf1_ioctl_i(p, uap, cmd, dir, len)
* structure, as DU interface names are all different.
*/
for (ifn = 0; ifn < if_index; ifn++) {
- ifp = ifnet_byindex(ifn);
+ ifp = ifnet_byindex(ifn + 1);
/* Only look at ether interfaces, exclude alteon nics
* because osf/1 doesn't know about most of them.
*/
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index ab80494..73d5390 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -1385,7 +1385,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
* structure, as Linux interface names are all different.
*/
for (ifn = 0; ifn < if_index; ifn++) {
- ifp = ifnet_byindex(ifn);
+ ifp = ifnet_byindex(ifn + 1);
if (ifp->if_type == IFT_ETHER) {
ifa = TAILQ_FIRST(&ifp->if_addrhead);
while (ifa) {
OpenPOWER on IntegriCloud