aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2005-01-30 08:12:37 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2005-01-30 08:12:37 +0000
commit43792195376d49565d1ce5daf330b19f90bce1d3 (patch)
tree60c80029e1db66c753066e1ca06309b6a56d0ce6 /sys/compat/linux/linux_ioctl.c
parent6b0206227514ad8c99ed9d119fdf795ca94fe7df (diff)
downloadsrc-43792195376d49565d1ce5daf330b19f90bce1d3.tar.gz
src-43792195376d49565d1ce5daf330b19f90bce1d3.zip
Boot away another stackgap (one of the lest ones in linuxlator/i386) by
providing special version of CDIOCREADSUBCHANNEL ioctl(), which assumes that result has to be placed into kernel space not user space. In the long run more generic solution has to be designed WRT emulating various ioctl()s that operate on userspace buffers, but right now there is only one such ioctl() is emulated, so that it makes little sense. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=141031
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r--sys/compat/linux/linux_ioctl.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index beb9e0c0aea6..20a2aa92f1b5 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -1490,30 +1490,29 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
case LINUX_CDROMSUBCHNL: {
struct linux_cdrom_subchnl sc;
struct ioc_read_subchannel bsdsc;
- struct cd_sub_channel_info *bsdinfo;
- caddr_t sg = stackgap_init();
- bsdinfo = stackgap_alloc(&sg, sizeof(*bsdinfo));
+ struct cd_sub_channel_info bsdinfo;
+
bsdsc.address_format = CD_LBA_FORMAT;
bsdsc.data_format = CD_CURRENT_POSITION;
bsdsc.track = 0;
- bsdsc.data_len = sizeof(*bsdinfo);
- bsdsc.data = bsdinfo;
- error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc,
- td->td_ucred, td);
+ bsdsc.data_len = sizeof(bsdinfo);
+ bsdsc.data = &bsdinfo;
+ error = fo_ioctl(fp, CDIOCREADSUBCHANNEL_SYSSPACE,
+ (caddr_t)&bsdsc, td->td_ucred, td);
if (error)
break;
error = copyin((void *)args->arg, &sc, sizeof(sc));
if (error)
break;
- sc.cdsc_audiostatus = bsdinfo->header.audio_status;
- sc.cdsc_adr = bsdinfo->what.position.addr_type;
- sc.cdsc_ctrl = bsdinfo->what.position.control;
- sc.cdsc_trk = bsdinfo->what.position.track_number;
- sc.cdsc_ind = bsdinfo->what.position.index_number;
+ sc.cdsc_audiostatus = bsdinfo.header.audio_status;
+ sc.cdsc_adr = bsdinfo.what.position.addr_type;
+ sc.cdsc_ctrl = bsdinfo.what.position.control;
+ sc.cdsc_trk = bsdinfo.what.position.track_number;
+ sc.cdsc_ind = bsdinfo.what.position.index_number;
set_linux_cdrom_addr(&sc.cdsc_absaddr, sc.cdsc_format,
- bsdinfo->what.position.absaddr.lba);
+ bsdinfo.what.position.absaddr.lba);
set_linux_cdrom_addr(&sc.cdsc_reladdr, sc.cdsc_format,
- bsdinfo->what.position.reladdr.lba);
+ bsdinfo.what.position.reladdr.lba);
error = copyout(&sc, (void *)args->arg, sizeof(sc));
break;
}