Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153071509
D24487.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
987 B
Referenced Files
None
Subscribers
None
D24487.diff
View Options
Index: head/sys/cam/scsi/scsi_enc_ses.c
===================================================================
--- head/sys/cam/scsi/scsi_enc_ses.c
+++ head/sys/cam/scsi/scsi_enc_ses.c
@@ -2904,13 +2904,19 @@
buf[1] = 0;
buf[2] = sstr->bufsiz >> 8;
buf[3] = sstr->bufsiz & 0xff;
- memcpy(&buf[4], sstr->buf, sstr->bufsiz);
+ ret = copyin(sstr->buf, &buf[4], sstr->bufsiz);
+ if (ret != 0) {
+ ENC_FREE(buf);
+ return (ret);
+ }
break;
case ENCIOC_GETSTRING:
payload = sstr->bufsiz;
amt = payload;
+ buf = ENC_MALLOC(payload);
+ if (buf == NULL)
+ return (ENOMEM);
ses_page_cdb(cdb, payload, SesStringIn, CAM_DIR_IN);
- buf = sstr->buf;
break;
case ENCIOC_GETENCNAME:
if (ses_cache->ses_nsubencs < 1)
@@ -2950,6 +2956,8 @@
return (EINVAL);
}
ret = enc_runcmd(enc, cdb, 6, buf, &amt);
+ if (ret == 0 && ioc == ENCIOC_GETSTRING)
+ ret = copyout(buf, sstr->buf, sstr->bufsiz);
if (ioc == ENCIOC_SETSTRING)
ENC_FREE(buf);
return (ret);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 11:10 PM (16 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31806712
Default Alt Text
D24487.diff (987 B)
Attached To
Mode
D24487: Don't access a user buffer directly from the kernel.
Attached
Detach File
Event Timeline
Log In to Comment