Thread (51 messages) 51 messages, 7 authors, 2023-05-24

Re: [PATCH net 6/6] net/sched: qdisc_destroy() old ingress and clsact Qdiscs before grafting

From: Peilin Ye <hidden>
Date: 2023-05-17 21:19:33
Also in: lkml

On Wed, May 17, 2023 at 11:48:25AM -0700, Jakub Kicinski wrote:
quoted
            } else {
-                   dev_queue = dev_ingress_queue(dev);
-                   old = dev_graft_qdisc(dev_queue, new);
+                   old = dev_graft_qdisc(dev_queue, NULL);
+
+                   /* {ingress,clsact}_destroy() "old" before grafting "new" to avoid
+                    * unprotected concurrent accesses to net_device::miniq_{in,e}gress
+                    * pointer(s) in mini_qdisc_pair_swap().
+                    */
+                   qdisc_notify(net, skb, n, classid, old, new, extack);
+                   qdisc_destroy(old);
+
+                   dev_graft_qdisc(dev_queue, new);
BTW can't @old be NULL here?
ingress_queue->qdisc_sleeping is initialized to &noop_qdisc (placeholder)
in dev_ingress_queue_create(), and dev_graft_qdisc() also grafts
&noop_qdisc to represent "there's no Qdisc":

	/* ... and graft new one */
	if (qdisc == NULL)
		qdisc = &noop_qdisc;
	dev_queue->qdisc_sleeping = qdisc;

So @old can't be NULL here.

Thanks,
Peilin Ye
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help