svn commit: r333768 - stable/11/sys/dev/mmc
Marius Strobl
marius at FreeBSD.org
Thu May 17 21:23:15 UTC 2018
Author: marius
Date: Thu May 17 21:23:14 2018
New Revision: 333768
URL: https://svnweb.freebsd.org/changeset/base/333768
Log:
MFC: r333614
Let mmcsd_ioctl() ensure appropriate privileges via priv_check(9).
Approved by: re (gjb, kib)
Modified:
stable/11/sys/dev/mmc/mmcsd.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/mmc/mmcsd.c
==============================================================================
--- stable/11/sys/dev/mmc/mmcsd.c Thu May 17 21:22:19 2018 (r333767)
+++ stable/11/sys/dev/mmc/mmcsd.c Thu May 17 21:23:14 2018 (r333768)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/priv.h>
#include <sys/slicer.h>
#include <sys/time.h>
@@ -177,7 +178,7 @@ static int mmcsd_bus_bit_width(device_t dev);
static daddr_t mmcsd_delete(struct mmcsd_part *part, struct bio *bp);
static const char *mmcsd_errmsg(int e);
static int mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data,
- int fflag);
+ int fflag, struct thread *td);
static int mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic,
int fflag);
static uintmax_t mmcsd_pretty_size(off_t size, char *unit);
@@ -771,22 +772,23 @@ mmcsd_strategy(struct bio *bp)
static int
mmcsd_ioctl_rpmb(struct cdev *dev, u_long cmd, caddr_t data,
- int fflag, struct thread *td __unused)
+ int fflag, struct thread *td)
{
- return (mmcsd_ioctl(dev->si_drv1, cmd, data, fflag));
+ return (mmcsd_ioctl(dev->si_drv1, cmd, data, fflag, td));
}
static int
mmcsd_ioctl_disk(struct disk *disk, u_long cmd, void *data, int fflag,
- struct thread *td __unused)
+ struct thread *td)
{
- return (mmcsd_ioctl(disk->d_drv1, cmd, data, fflag));
+ return (mmcsd_ioctl(disk->d_drv1, cmd, data, fflag, td));
}
static int
-mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag)
+mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void *data, int fflag,
+ struct thread *td)
{
struct mmc_ioc_cmd *mic;
struct mmc_ioc_multi_cmd *mimc;
@@ -795,6 +797,10 @@ mmcsd_ioctl(struct mmcsd_part *part, u_long cmd, void
if ((fflag & FREAD) == 0)
return (EBADF);
+
+ err = priv_check(td, PRIV_DRIVER);
+ if (err != 0)
+ return (err);
err = 0;
switch (cmd) {
More information about the svn-src-stable-11
mailing list