mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabian Frederick <Fabian.Frederick@skynet.be>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.6.5rc2-mm2] Root_plug device check
Date: Sat, 03 Apr 2004 10:42:33 +0200	[thread overview]
Message-ID: <1080981753.4309.26.camel@linux.local> (raw)

[-- Attachment #1: Type: text/plain, Size: 117 bytes --]

Hi,

      Here's a patch to check device in root_plug to avoid box freeze
when user gives bad ids.

Regards,
Fabian

[-- Attachment #2: root_plug1.diff --]
[-- Type: text/x-patch, Size: 1466 bytes --]

diff -Naur orig/security/root_plug.c edited/security/root_plug.c
--- orig/security/root_plug.c	2004-03-25 23:54:19.000000000 +0100
+++ edited/security/root_plug.c	2004-03-26 23:39:26.000000000 +0100
@@ -20,6 +20,9 @@
  *	modify it under the terms of the GNU General Public License as
  *	published by the Free Software Foundation, version 2 of the
  *	License.
+ *
+ * 03/2004 : (Fabian Frederick) 
+ *		-Make sure we have device if defined through module call
  */
 
 #include <linux/config.h>
@@ -33,8 +36,11 @@
 static int secondary;
 
 /* default is a generic type of usb to serial converter */
-static int vendor_id = 0x0557;
-static int product_id = 0x2008;
+#define DEFAULT_VENDOR 0x0557
+#define DEFAULT_PRODUCT 0x2008
+
+static int vendor_id = DEFAULT_VENDOR;
+static int product_id = DEFAULT_PRODUCT;
 
 MODULE_PARM(vendor_id, "h");
 MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for");
@@ -101,6 +107,17 @@
 
 static int __init rootplug_init (void)
 {
+	struct usb_device *dev;
+
+	/* check we have device featuring in usb list to avoid any trouble*/
+	if((vendor_id!=DEFAULT_VENDOR) || (product_id!=DEFAULT_PRODUCT)){
+		dev = usb_find_device(vendor_id, product_id);
+		if (!dev) {
+			printk (KERN_INFO "Unable to find USB device "
+				" We won't start to avoid box freeze.\n");
+			return -EINVAL;
+		}
+	}
 	/* register ourselves with the security framework */
 	if (register_security (&rootplug_security_ops)) {
 		printk (KERN_INFO 

             reply	other threads:[~2004-04-03  8:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-03  8:42 Fabian Frederick [this message]
2004-04-07 18:21 ` Greg KH

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=1080981753.4309.26.camel@linux.local \
    --to=fabian.frederick@skynet.be \
    --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

Powered by JetHome