[PATCH RESEND v2 02/51] scsi: esas2r: don't copy kernel pointers out in EXPRESS_IOCTL_GET_MOD_INFO

From: Christian Brauner

Date: Wed Nov 04 2026 - 14:59:35 EST


EXPRESS_IOCTL_GET_MOD_INFO fills in the addresses of the adapter, its
pci_dev and its Scsi_Host and copies the whole struct back to userspace.
Nothing in userspace can do anything with those addresses, and the
ioctl is reachable through /proc/scsi/esas2r/ATTONode, which is created
with mode 0444. Only pass the host number.

Fixes: 26780d9e12ed ("[SCSI] esas2r: ATTO Technology ExpressSAS 6G SAS/SATA RAID Adapter Driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
---
drivers/scsi/esas2r/esas2r_ioctl.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
index 3f7c1d131ec3..c93d9265e100 100644
--- a/drivers/scsi/esas2r/esas2r_ioctl.c
+++ b/drivers/scsi/esas2r/esas2r_ioctl.c
@@ -1468,9 +1468,10 @@ int esas2r_ioctl_handler(void *hostdata, unsigned int cmd, void __user *arg)

case EXPRESS_IOCTL_GET_MOD_INFO:

- ioctl->data.modinfo.adapter = a;
- ioctl->data.modinfo.pci_dev = a->pcid;
- ioctl->data.modinfo.scsi_host = a->host;
+ /* these are kernel pointers, userspace has no use for them */
+ ioctl->data.modinfo.adapter = NULL;
+ ioctl->data.modinfo.pci_dev = NULL;
+ ioctl->data.modinfo.scsi_host = NULL;
ioctl->data.modinfo.host_no = a->host->host_no;

break;

--
2.53.0