Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   Adds support for security checks in the linear target (http://www.linux-archive.org/device-mapper-development/670962-adds-support-security-checks-linear-target.html)

Ondrej Kozina 05-25-2012 01:22 PM

Adds support for security checks in the linear target
 
Just a security check implementation for linear target

---
drivers/md/dm-linear.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
index 3639eea..b04aa00 100644
--- a/drivers/md/dm-linear.c
+++ b/drivers/md/dm-linear.c
@@ -153,9 +153,25 @@ static int linear_iterate_devices(struct dm_target *ti,
return fn(ti, lc->dev, lc->start, ti->len, data);
}

+static int linear_security(struct dm_target *ti, unsigned int argc, char **argv)
+{
+ int r;
+
+ if (argc < 1) {
+ ti->error = "dm-linear: Security check: invalid number of parameters";
+ return -EINVAL;
+ }
+
+ r = dm_check_backing_dev_permission(ti, argv[0]);
+ if (r)
+ ti->error = "dm-linear: Security check failed";
+
+ return r;
+}
+
static struct target_type linear_target = {
.name = "linear",
- .version = {1, 1, 0},
+ .version = {1, 2, 0},
.module = THIS_MODULE,
.ctr = linear_ctr,
.dtr = linear_dtr,
@@ -164,6 +180,7 @@ static struct target_type linear_target = {
.ioctl = linear_ioctl,
.merge = linear_merge,
.iterate_devices = linear_iterate_devices,
+ .security = linear_security
};

int __init dm_linear_init(void)
--
1.7.8.6

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


All times are GMT. The time now is 12:50 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.