From: Fred Emmott <mail@fredemmott.co.uk>
To: linux-kernel@vger.kernel.org
Subject: [patch] root_plug improvement
Date: Thu, 25 Nov 2004 18:19:04 +0000 [thread overview]
Message-ID: <200411251819.04700.mail@fredemmott.co.uk> (raw)
This patch makes the root_plug LSM module also check the serial number of the
USB device. Without this, it's possible to use another USB device of the same
brand + model as a root_plug device.
I am not familiar with the module interface, and have not added a paramater
for specifying the serial_number, so it must be specified at compile time.
Sorry if this is the wrong place to send this.
--- root_plug.c.orig 2004-11-25 18:05:30.000000000 +0000
+++ root_plug.c 2004-11-25 18:06:45.000000000 +0000
@@ -35,6 +36,7 @@
/* default is a generic type of usb to serial converter */
static int vendor_id = 0x0557;
static int product_id = 0x2008;
+char *serial_number = "ENTER_ID_HERE";
module_param(vendor_id, uint, 0400);
MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for");
@@ -65,7 +67,9 @@
static int rootplug_bprm_check_security (struct linux_binprm *bprm)
{
struct usb_device *dev;
-
+ char* buf;
+ buf = kmalloc(128, GFP_KERNEL);
+
root_dbg("file %s, e_uid = %d, e_gid = %d\n",
bprm->filename, bprm->e_uid, bprm->e_gid);
@@ -76,6 +80,15 @@
"task not allowed to run...\n");
return -EPERM;
}
+ else {
+ usb_string(dev, dev->descriptor.iSerialNumber, buf, 128);
+ if (strcmp(buf, serial_number) != 0)
+ {
+ root_dbg("e_gid = 0, and device found, "
+ "but bad serial number...\n");
+ return -EPERM;
+ }
+ }
usb_put_dev(dev);
}
--
Fred Emmott
(http://www.fredemmott.co.uk)
reply other threads:[~2004-11-27 4:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200411251819.04700.mail@fredemmott.co.uk \
--to=mail@fredemmott.co.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®