diff options
author | phk <phk@FreeBSD.org> | 2004-12-12 10:09:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-12 10:09:05 +0000 |
commit | 35b3c9fdfbd8e466654ebad62b044a7d3c01f3b7 (patch) | |
tree | c331a8f51b025987771bf29e5baf7455e29185d9 /sys/dev | |
parent | cfac934dde18f8d08432e5509b2dd827eb77be2c (diff) | |
download | FreeBSD-src-35b3c9fdfbd8e466654ebad62b044a7d3c01f3b7.zip FreeBSD-src-35b3c9fdfbd8e466654ebad62b044a7d3c01f3b7.tar.gz |
Pass the file->flags down to geom ioctl handlers.
Reject certain ioctls if write permission is not indicated.
Bump geom API version.
Reported by: Ruben de Groot <mail25@bzerk.org>
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 4 | ||||
-rw-r--r-- | sys/dev/fdc/fdc.c | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 6c36f99..9b86948 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -63,7 +63,7 @@ static void acd_describe(struct acd_softc *); static void lba2msf(u_int32_t, u_int8_t *, u_int8_t *, u_int8_t *); static u_int32_t msf2lba(u_int8_t, u_int8_t, u_int8_t); static int acd_geom_access(struct g_provider *, int, int, int); -static int acd_geom_ioctl(struct g_provider *, u_long, void *, struct thread *); +static g_ioctl_t acd_geom_ioctl; static void acd_geom_start(struct bio *); static void acd_done(struct ata_request *); static void acd_read_toc(struct acd_softc *); @@ -550,7 +550,7 @@ acd_geom_access(struct g_provider *pp, int dr, int dw, int de) } static int -acd_geom_ioctl(struct g_provider *pp, u_long cmd, void *addr, struct thread *td) +acd_geom_ioctl(struct g_provider *pp, u_long cmd, void *addr, int fflag, struct thread *td) { struct acd_softc *cdp = pp->geom->softc; int error = 0; diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 5846b0a..7c51590 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -1407,7 +1407,7 @@ fd_start(struct bio *bp) } static int -fd_ioctl(struct g_provider *pp, u_long cmd, void *data, struct thread *td) +fd_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) { struct fd_data *fd; struct fdc_status *fsp; @@ -1422,6 +1422,8 @@ fd_ioctl(struct g_provider *pp, u_long cmd, void *data, struct thread *td) return (0); case FD_STYPE: /* set drive type */ + if (!fflag & FWRITE) + return (EPERM); /* * Allow setting drive type temporarily iff * currently unset. Used for fdformat so any @@ -1443,6 +1445,8 @@ fd_ioctl(struct g_provider *pp, u_long cmd, void *data, struct thread *td) return (0); case FD_SOPTS: /* set drive options */ + if (!fflag & FWRITE) + return (EPERM); fd->options = *(int *)data; return (0); @@ -1464,6 +1468,8 @@ fd_ioctl(struct g_provider *pp, u_long cmd, void *data, struct thread *td) return (0); case FD_FORM: + if (!fflag & FWRITE) + return (EPERM); if (((struct fd_formb *)data)->format_version != FD_FORMAT_VERSION) return (EINVAL); /* wrong version of formatting prog */ |