summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2018-03-27 17:51:45 +0000
committerbrooks <brooks@FreeBSD.org>2018-03-27 17:51:45 +0000
commit6ff2febdb2814c8be2189d37da623bbf43dfb4d8 (patch)
tree26bc23d46dd060495b1bcb6976a801005e3eccc4
parent46a38e8a577073c04d90ed396b0604db66b8b0cd (diff)
downloadFreeBSD-src-6ff2febdb2814c8be2189d37da623bbf43dfb4d8.zip
FreeBSD-src-6ff2febdb2814c8be2189d37da623bbf43dfb4d8.tar.gz
MFC r330949:
Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat. This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB. Reviewed by: cem Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14672
-rw-r--r--sys/dev/aac/aac.c17
-rw-r--r--sys/dev/aacraid/aacraid.c17
-rw-r--r--sys/modules/aac/Makefile2
-rw-r--r--sys/modules/aacraid/Makefile2
-rw-r--r--sys/sys/aac_ioctl.h8
5 files changed, 42 insertions, 4 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c
index 3d08f11..1d01a69 100644
--- a/sys/dev/aac/aac.c
+++ b/sys/dev/aac/aac.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#define AAC_DRIVERNAME "aac"
#include "opt_aac.h"
+#include "opt_compat.h"
/* #include <stddef.h> */
#include <sys/param.h>
@@ -45,7 +46,9 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/proc.h>
#include <sys/sysctl.h>
+#include <sys/sysent.h>
#include <sys/poll.h>
#include <sys/ioccom.h>
@@ -3522,7 +3525,19 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
- if ((error = copyin(arg, &agf, sizeof(agf))) == 0) {
+#ifdef COMPAT_FREEBSD32
+ if (SV_CURPROC_FLAG(SV_ILP32)) {
+ struct get_adapter_fib_ioctl32 agf32;
+ error = copyin(arg, &agf32, sizeof(agf32));
+ if (error == 0) {
+ agf.AdapterFibContext = agf32.AdapterFibContext;
+ agf.Wait = agf32.Wait;
+ agf.AifFib = (caddr_t)(uintptr_t)agf32.AifFib;
+ }
+ } else
+#endif
+ error = copyin(arg, &agf, sizeof(agf));
+ if (error == 0) {
for (ctx = sc->fibctx; ctx; ctx = ctx->next) {
if (agf.AdapterFibContext == ctx->unique)
break;
diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c
index 5a4854e..b51a182 100644
--- a/sys/dev/aacraid/aacraid.c
+++ b/sys/dev/aacraid/aacraid.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#define AAC_DRIVERNAME "aacraid"
#include "opt_aacraid.h"
+#include "opt_compat.h"
/* #include <stddef.h> */
#include <sys/param.h>
@@ -46,7 +47,9 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
+#include <sys/proc.h>
#include <sys/sysctl.h>
+#include <sys/sysent.h>
#include <sys/poll.h>
#include <sys/ioccom.h>
@@ -3382,7 +3385,19 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
mtx_lock(&sc->aac_io_lock);
- if ((error = copyin(arg, &agf, sizeof(agf))) == 0) {
+#ifdef COMPAT_FREEBSD32
+ if (SV_CURPROC_FLAG(SV_ILP32)) {
+ struct get_adapter_fib_ioctl32 agf32;
+ error = copyin(arg, &agf32, sizeof(agf32));
+ if (error == 0) {
+ agf.AdapterFibContext = agf32.AdapterFibContext;
+ agf.Wait = agf32.Wait;
+ agf.AifFib = (caddr_t)(uintptr_t)agf32.AifFib;
+ }
+ } else
+#endif
+ error = copyin(arg, &agf, sizeof(agf));
+ if (error == 0) {
for (ctx = sc->fibctx; ctx; ctx = ctx->next) {
if (agf.AdapterFibContext == ctx->unique)
break;
diff --git a/sys/modules/aac/Makefile b/sys/modules/aac/Makefile
index 1a5b433..4810d4e 100644
--- a/sys/modules/aac/Makefile
+++ b/sys/modules/aac/Makefile
@@ -8,7 +8,7 @@ SUBDIR= aac_linux
KMOD= aac
SRCS= aac.c aac_pci.c aac_disk.c aac_cam.c
-SRCS+= opt_scsi.h opt_cam.h opt_aac.h
+SRCS+= opt_scsi.h opt_cam.h opt_compat.h opt_aac.h
SRCS+= device_if.h bus_if.h pci_if.h
# To enable debug output from the driver, uncomment these two lines.
diff --git a/sys/modules/aacraid/Makefile b/sys/modules/aacraid/Makefile
index 8852d47..2209ead 100644
--- a/sys/modules/aacraid/Makefile
+++ b/sys/modules/aacraid/Makefile
@@ -8,7 +8,7 @@ SUBDIR= aacraid_linux
KMOD= aacraid
SRCS= aacraid.c aacraid_pci.c aacraid_cam.c
-SRCS+= opt_scsi.h opt_cam.h opt_aacraid.h
+SRCS+= opt_scsi.h opt_cam.h opt_compat.h opt_aacraid.h
SRCS+= device_if.h bus_if.h pci_if.h
# To enable debug output from the driver, uncomment these two lines.
diff --git a/sys/sys/aac_ioctl.h b/sys/sys/aac_ioctl.h
index 2ed9530..6b6e2de 100644
--- a/sys/sys/aac_ioctl.h
+++ b/sys/sys/aac_ioctl.h
@@ -175,6 +175,14 @@ struct get_adapter_fib_ioctl {
caddr_t AifFib;
};
+#ifdef _KERNEL
+struct get_adapter_fib_ioctl32 {
+ u_int32_t AdapterFibContext;
+ int Wait;
+ u_int32_t AifFib;
+};
+#endif
+
struct aac_query_disk {
int32_t ContainerNumber;
int32_t Bus;
OpenPOWER on IntegriCloud