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>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 18 May 2007 23:06:18 +0200
From:	Oliver Hartkopp <socketcan@...tkopp.net>
To:	paulmck@...ux.vnet.ibm.com
CC:	Urs Thuermann <urs@...ogud.escape.de>, netdev@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>,
	Oliver Hartkopp <oliver.hartkopp@...kswagen.de>,
	Urs Thuermann <urs.thuermann@...kswagen.de>
Subject: Re: [patch 2/7] CAN: Add PF_CAN core module

Hello Paul,

as you may see in the attached SVN-log i changed some code according 
your suggestions.
I additionally made some clarifications of function names.

If you would like to see the af_can.c completely please visit:
http://svn.berlios.de/svnroot/repos/socketcan/trunk/kernel/2.6/net/can/af_can.c

But this code in the projekt SVN is working for several kernel versions 
(which is removed by some scripts when creating a LKML netdev patch) - 
just for your information.

Best regards,
Oliver

-------- Original-Nachricht --------
Betreff: 	r311 - trunk/kernel/2.6/net/can
Datum: 	Fri, 18 May 2007 21:47:15 +0200
Von: 	hartkopp@...l.berlios.de
An: 	socketcan-commit@...ts.berlios.de



Author: hartkopp
Date: 2007-05-18 21:47:14 +0200 (Fri, 18 May 2007)
New Revision: 311

Modified:
   trunk/kernel/2.6/net/can/af_can.c
Log:
Updated RCU removal of dev_rcv_lists structures in the case of CAN-interfaces
going down (in can_notifier). Thanks to Paul E. McKenny (IBM) who gave this
hint on netdev kernel mailinglist.


Modified: trunk/kernel/2.6/net/can/af_can.c
===================================================================
--- trunk/kernel/2.6/net/can/af_can.c	2007-05-16 09:03:21 UTC (rev 310)
+++ trunk/kernel/2.6/net/can/af_can.c	2007-05-18 19:47:14 UTC (rev 311)
@@ -454,31 +454,48 @@
 }
 EXPORT_SYMBOL(can_rx_register);
 
-static void can_rcv_lists_delete(struct rcu_head *rp)
+static void can_rx_delete_list(struct hlist_head *rl)
 {
+	struct receiver *r;
+	struct hlist_node *n;
+
+	hlist_for_each_entry_rcu(r, n, rl, list) {
+		hlist_del_rcu(&r->list);
+		kmem_cache_free(rcv_cache, r);
+	}
+}
+
+/*
+ * can_rx_delete_device - rcu callback for dev_rcv_lists structure removal
+ */
+static void can_rx_delete_device(struct rcu_head *rp)
+{
 	struct dev_rcv_lists *d = container_of(rp, struct dev_rcv_lists, rcu);
+	int i;
 
+	/* remove all receivers hooked at this netdevice */
+	can_rx_delete_list(&d->rx_err);
+	can_rx_delete_list(&d->rx_all);
+	can_rx_delete_list(&d->rx_fil);
+	can_rx_delete_list(&d->rx_inv);
+	can_rx_delete_list(&d->rx_eff);
+
+	for (i = 0; i < 2048; i++)
+		can_rx_delete_list(&d->rx_sff[i]);
+
 	kfree(d);
 }
 
-static void can_rx_delete(struct rcu_head *rp)
+/*
+ * can_rx_delete_receiver - rcu callback for single receiver entry removal
+ */
+static void can_rx_delete_receiver(struct rcu_head *rp)
 {
 	struct receiver *r = container_of(rp, struct receiver, rcu);
 
 	kmem_cache_free(rcv_cache, r);
 }
 
-static void can_rx_delete_all(struct hlist_head *rl)
-{
-	struct receiver *r;
-	struct hlist_node *n;
-
-	hlist_for_each_entry_rcu(r, n, rl, list) {
-		hlist_del_rcu(&r->list);
-		call_rcu(&r->rcu, can_rx_delete);
-	}
-}
-
 /**
  * can_rx_unregister - unsubscribe CAN frames from a specific interface
  * @dev: pointer to netdevice (NULL => unsubcribe from 'all' CAN devices list)
@@ -556,7 +573,7 @@
 
 	/* schedule the receiver item for deletion */
 	if (r)
-		call_rcu(&r->rcu, can_rx_delete);
+		call_rcu(&r->rcu, can_rx_delete_receiver);
 
 	return ret;
 }
@@ -945,7 +962,6 @@
 	struct net_device *dev = (struct net_device *)data;
 	struct notifier *n;
 	struct dev_rcv_lists *d;
-	int i;
 
 	DBG("called for %s, msg = %lu\n", dev->name, msg);
 
@@ -986,25 +1002,16 @@
 		spin_lock_bh(&rcv_lists_lock);
 
 		d = find_dev_rcv_lists(dev);
-		if (d) {
+		if (d)
 			hlist_del_rcu(&d->list);
-
-			/* remove all receivers hooked at this netdevice */
-			can_rx_delete_all(&d->rx_err);
-			can_rx_delete_all(&d->rx_all);
-			can_rx_delete_all(&d->rx_fil);
-			can_rx_delete_all(&d->rx_inv);
-			can_rx_delete_all(&d->rx_eff);
-			for (i = 0; i < 2048; i++)
-				can_rx_delete_all(&d->rx_sff[i]);
-		} else
+		else
 			printk(KERN_ERR "can: notifier: receive list not "
 			       "found for dev %s\n", dev->name);
 
 		spin_unlock_bh(&rcv_lists_lock);
 
 		if (d)
-			call_rcu(&d->rcu, can_rcv_lists_delete);
+			call_rcu(&d->rcu, can_rx_delete_device);
 
 		break;
 	}

_______________________________________________
Socketcan-commit mailing list
Socketcan-commit@...ts.berlios.de
https://lists.berlios.de/mailman/listinfo/socketcan-commit


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ