Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174515663
D43176.id131852.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D43176.id131852.diff
View Options
diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c
--- a/sys/dev/mps/mps_user.c
+++ b/sys/dev/mps/mps_user.c
@@ -715,9 +715,9 @@
}
mps_unlock(sc);
- copyout(rpl, cmd->rpl, sz);
- if (buf != NULL)
- copyout(buf, cmd->buf, cmd->len);
+ err = copyout(rpl, cmd->rpl, sz);
+ if (buf != NULL && err == 0)
+ err = copyout(buf, cmd->buf, cmd->len);
mps_dprint(sc, MPS_USER, "%s: reply size %d\n", __func__, sz);
RetFreeUnlocked:
@@ -847,7 +847,7 @@
/*
* Copy the reply data and sense data to user space.
*/
- if ((cm != NULL) && (cm->cm_reply != NULL)) {
+ if (err == 0 && cm != NULL && cm->cm_reply != NULL) {
rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply;
sz = rpl->MsgLength * 4;
@@ -857,8 +857,11 @@
__func__, data->ReplySize, sz);
}
mps_unlock(sc);
- copyout(cm->cm_reply, PTRIN(data->PtrReply),
+ err = copyout(cm->cm_reply, PTRIN(data->PtrReply),
MIN(sz, data->ReplySize));
+ if (err != 0)
+ mps_dprint(sc, MPS_FAULT,
+ "%s: copyout failed\n", __func__);
mps_lock(sc);
}
mpssas_free_tm(sc, cm);
@@ -1001,7 +1004,7 @@
/*
* Copy the reply data and sense data to user space.
*/
- if (cm->cm_reply != NULL) {
+ if (err == 0 && cm->cm_reply != NULL) {
rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply;
sz = rpl->MsgLength * 4;
@@ -1011,12 +1014,16 @@
data->ReplySize, sz);
}
mps_unlock(sc);
- copyout(cm->cm_reply, PTRIN(data->PtrReply),
+ err = copyout(cm->cm_reply, PTRIN(data->PtrReply),
MIN(sz, data->ReplySize));
mps_lock(sc);
+ if (err != 0)
+ mps_dprint(sc, MPS_FAULT, "%s: failed to copy "
+ "IOCTL data to user space\n", __func__);
- if ((function == MPI2_FUNCTION_SCSI_IO_REQUEST) ||
- (function == MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
+ if (err == 0 &&
+ (function == MPI2_FUNCTION_SCSI_IO_REQUEST ||
+ function == MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
if (((MPI2_SCSI_IO_REPLY *)rpl)->SCSIState &
MPI2_SCSI_STATE_AUTOSENSE_VALID) {
sense_len =
@@ -1024,9 +1031,13 @@
SenseCount)), sizeof(struct
scsi_sense_data));
mps_unlock(sc);
- copyout(cm->cm_sense, (PTRIN(data->PtrReply +
+ err = copyout(cm->cm_sense, (PTRIN(data->PtrReply +
sizeof(MPI2_SCSI_IO_REPLY))), sense_len);
mps_lock(sc);
+ if (err != 0)
+ mps_dprint(sc, MPS_FAULT,
+ "%s: failed to copy IOCTL data to "
+ "user space\n", __func__);
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 8:49 PM (2 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40208589
Default Alt Text
D43176.id131852.diff (2 KB)
Attached To
Mode
D43176: mps: Handle errors from copyout() in ioctl handlers
Attached
Detach File
Event Timeline
Log In to Comment