lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4652E1E4.4080708@colognechip.com>
Date:	Tue, 22 May 2007 14:28:20 +0200
From:	Martin Bachem <info@...ognechip.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	linux-kernel@...r.kernel.org, torvalds@...l.org
Subject: [PATCH 2.6.21.1] hisax: adds error-checking for hisax_register()

This patch (as875) adds error-checking to the callers of
hisax_register().  It also changes an error pathway in that routine,
making it return an error code rather than 0.

This fixes Bugzilla #7960.

Signed-off-by: Alan Stern <stern@...land.harvard.edu>
Signed-off-by: Martin Bachem <info@...ognechip.com>
Acked-by: Karsten Keil <kkeil@...e.de>

---

Index: usb-2.6/drivers/isdn/hisax/config.c
===================================================================
--- usb-2.6.orig/drivers/isdn/hisax/config.c
+++ usb-2.6/drivers/isdn/hisax/config.c
@@ -1551,7 +1551,7 @@ int hisax_register(struct hisax_d_if *hi
 	if (retval == 0) { // yuck
 		cards[i].typ = 0;
 		nrcards--;
-		return retval;
+		return -EINVAL;
 	}
 	cs = cards[i].cs;
 	hisax_d_if->cs = cs;
Index: usb-2.6/drivers/isdn/hisax/hfc_usb.c
===================================================================
--- usb-2.6.orig/drivers/isdn/hisax/hfc_usb.c
+++ usb-2.6/drivers/isdn/hisax/hfc_usb.c
@@ -1306,7 +1306,11 @@ usb_init(hfcusb_data * hfc)
 	}
 	/* default Prot: EURO ISDN, should be a module_param */
 	hfc->protocol = 2;
-	hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol);
+	i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol);
+	if (i) {
+		printk(KERN_INFO "HFC-S USB: hisax_register -> %d\n", i);
+		return i;
+	}

 #ifdef CONFIG_HISAX_DEBUG
 	hfc_debug = debug;
Index: usb-2.6/drivers/isdn/hisax/hisax_fcpcipnp.c
===================================================================
--- usb-2.6.orig/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ usb-2.6/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -859,7 +859,11 @@ new_adapter(void)
 	for (i = 0; i < 2; i++)
 		b_if[i] = &adapter->bcs[i].b_if;

-	hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp", protocol);
+	if (hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp",
+			protocol) != 0) {
+		kfree(adapter);
+		adapter = NULL;
+	}

 	return adapter;
 }
Index: usb-2.6/drivers/isdn/hisax/st5481_init.c
===================================================================
--- usb-2.6.orig/drivers/isdn/hisax/st5481_init.c
+++ usb-2.6/drivers/isdn/hisax/st5481_init.c
@@ -107,12 +107,17 @@ static int probe_st5481(struct usb_inter
 	for (i = 0; i < 2; i++)
 		b_if[i] = &adapter->bcs[i].b_if;

-	hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", protocol);
+	if (hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb",
+			protocol) != 0)
+		goto err_b1;
+
 	st5481_start(adapter);

 	usb_set_intfdata(intf, adapter);
 	return 0;

+ err_b1:
+	st5481_release_b(&adapter->bcs[1]);
  err_b:
 	st5481_release_b(&adapter->bcs[0]);
  err_d:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ