aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-10-01 17:30:38 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-10-01 17:30:38 +0000
commit84b6afb5363623dcb3adb1d44f73c97ef9e23582 (patch)
tree5003972241fdd837185b38383162e110b7f8b758
parent8604f4ae91aca75e4099e0da737c609419cd0d15 (diff)
downloadsrc-84b6afb5363623dcb3adb1d44f73c97ef9e23582.tar.gz
src-84b6afb5363623dcb3adb1d44f73c97ef9e23582.zip
MFS 366297: Revert most of r360179.
I had failed to notice that sgsendccb() was using cam_periph_mapmem() and thus was not passing down user pointers directly to drivers. In practice this broke requests submitted from userland. PR: 249395 Approved by: re (gjb)
Notes
Notes: svn path=/releng/12.2/; revision=366332
-rw-r--r--sys/cam/scsi/scsi_sg.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c
index 5dc9e9168511..fd7e46138e80 100644
--- a/sys/cam/scsi/scsi_sg.c
+++ b/sys/cam/scsi/scsi_sg.c
@@ -508,7 +508,6 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
struct cam_periph *periph;
struct sg_softc *softc;
struct sg_io_hdr *req;
- void *data_ptr;
int dir, error;
periph = (struct cam_periph *)dev->si_drv1;
@@ -553,20 +552,12 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
break;
}
- if (req->dxfer_len > MAXPHYS) {
- error = EINVAL;
- break;
- }
-
- data_ptr = malloc(req->dxfer_len, M_DEVBUF, M_WAITOK);
-
ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL);
csio = &ccb->csio;
error = copyin(req->cmdp, &csio->cdb_io.cdb_bytes,
req->cmd_len);
if (error) {
- free(data_ptr, M_DEVBUF);
xpt_release_ccb(ccb);
break;
}
@@ -587,21 +578,12 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
break;
}
- if (dir == CAM_DIR_IN || dir == CAM_DIR_BOTH) {
- error = copyin(req->dxferp, data_ptr, req->dxfer_len);
- if (error) {
- free(data_ptr, M_DEVBUF);
- xpt_release_ccb(ccb);
- break;
- }
- }
-
cam_fill_csio(csio,
/*retries*/1,
/*cbfcnp*/NULL,
dir|CAM_DEV_QFRZDIS,
MSG_SIMPLE_Q_TAG,
- data_ptr,
+ req->dxferp,
req->dxfer_len,
req->mx_sb_len,
req->cmd_len,
@@ -611,7 +593,6 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
if (error) {
req->host_status = DID_ERROR;
req->driver_status = DRIVER_INVALID;
- free(data_ptr, M_DEVBUF);
xpt_release_ccb(ccb);
break;
}
@@ -630,10 +611,6 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
req->sb_len_wr);
}
- if ((dir == CAM_DIR_OUT || dir == CAM_DIR_BOTH) && error == 0)
- error = copyout(data_ptr, req->dxferp, req->dxfer_len);
-
- free(data_ptr, M_DEVBUF);
xpt_release_ccb(ccb);
break;