diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-12-04 12:40:25 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-12-04 12:40:25 +0000 |
commit | cf92efd859a395f572e8fdb1fada65ac7be45fb0 (patch) | |
tree | 08a74365025a332a86b7473aea3acde719ad5998 /usr/src/uts/common/os/streamio.c | |
parent | 1e3614d0308cc53fe5630084af9ef8719a9c44a8 (diff) | |
parent | 99d3b4e271d47a93935645d0c2d348d161f90c80 (diff) | |
download | illumos-joyent-cf92efd859a395f572e8fdb1fada65ac7be45fb0.tar.gz |
[illumos-gate merge]release-20191205
commit 99d3b4e271d47a93935645d0c2d348d161f90c80
11950 diff_cb() does not handle large dnodes
commit c4fc965c904c30ee88c7ec42768b39cdbb328de9
11979 libshell: bitwise comparison always evaluates to false
commit e63ea1f970505bef26ee06b3cef54076ad25b94e
12043 Streams ioctl for _I_CMD within kernel causes EFAULT
Diffstat (limited to 'usr/src/uts/common/os/streamio.c')
-rw-r--r-- | usr/src/uts/common/os/streamio.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/usr/src/uts/common/os/streamio.c b/usr/src/uts/common/os/streamio.c index 95c0a5e720..15d612078c 100644 --- a/usr/src/uts/common/os/streamio.c +++ b/usr/src/uts/common/os/streamio.c @@ -3613,29 +3613,39 @@ strioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, int copyflag, if (stp->sd_flag & STRHUP) return (ENXIO); - if ((scp = kmem_alloc(sizeof (strcmd_t), KM_NOSLEEP)) == NULL) - return (ENOMEM); + if (copyflag == U_TO_K) { + if ((scp = kmem_alloc(sizeof (strcmd_t), + KM_NOSLEEP)) == NULL) { + return (ENOMEM); + } - if (copyin((void *)arg, scp, sizeof (strcmd_t))) { - kmem_free(scp, sizeof (strcmd_t)); - return (EFAULT); + if (copyin((void *)arg, scp, sizeof (strcmd_t))) { + kmem_free(scp, sizeof (strcmd_t)); + return (EFAULT); + } + } else { + scp = (strcmd_t *)arg; } access = job_control_type(scp->sc_cmd); mutex_enter(&stp->sd_lock); if (access != -1 && (error = i_straccess(stp, access)) != 0) { mutex_exit(&stp->sd_lock); - kmem_free(scp, sizeof (strcmd_t)); + if (copyflag == U_TO_K) + kmem_free(scp, sizeof (strcmd_t)); return (error); } mutex_exit(&stp->sd_lock); *rvalp = 0; if ((error = strdocmd(stp, scp, crp)) == 0) { - if (copyout(scp, (void *)arg, sizeof (strcmd_t))) + if (copyflag == U_TO_K && + copyout(scp, (void *)arg, sizeof (strcmd_t))) { error = EFAULT; + } } - kmem_free(scp, sizeof (strcmd_t)); + if (copyflag == U_TO_K) + kmem_free(scp, sizeof (strcmd_t)); return (error); case I_NREAD: |