Skip to contentSkip to conversation

xen-netback: don't de-reference vif pointer after having called xenvif_put()

PATCH Superseded Jan Beulich 3 participants 13 messages Jun 5, 2013 – Jun 13, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netback: don't de-reference vif pointer after having called xenvif_put()

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

---
 drivers/net/xen-netback/netback.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/xen-netback/netback.c +6 -5
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct x
 {
 	struct xenvif *vif = NULL, *tmp;
 	s8 status;
-	u16 irq, flags;
+	u16 flags;
 	struct xen_netif_rx_response *resp;
 	struct sk_buff_head rxq;
 	struct sk_buff *skb;
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct x
 					 sco->meta_slots_used);
 
 		RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
-		irq = vif->irq;
-		if (ret && list_empty(&vif->notify_list))
-			list_add_tail(&vif->notify_list, &notify);
 
 		xenvif_notify_tx_completion(vif);
 
-		xenvif_put(vif);
+		if (ret && list_empty(&vif->notify_list))
+			list_add_tail(&vif->notify_list, &notify);
+		else
+			xenvif_put(vif);
 		npo.meta_cons += sco->meta_slots_used;
 		dev_kfree_skb(skb);
 	}
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct x
 	list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
 		notify_remote_via_irq(vif->irq);
 		list_del_init(&vif->notify_list);
+		xenvif_put(vif);
 	}
 
 	/* More work to do? */

xen-netback: don't de-reference vif pointer after having called xenvif_put()

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

---
 drivers/net/xen-netback/netback.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/xen-netback/netback.c +6 -5
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct x
 {
 	struct xenvif *vif = NULL, *tmp;
 	s8 status;
-	u16 irq, flags;
+	u16 flags;
 	struct xen_netif_rx_response *resp;
 	struct sk_buff_head rxq;
 	struct sk_buff *skb;
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct x
 					 sco->meta_slots_used);
 
 		RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
-		irq = vif->irq;
-		if (ret && list_empty(&vif->notify_list))
-			list_add_tail(&vif->notify_list, &notify);
 
 		xenvif_notify_tx_completion(vif);
 
-		xenvif_put(vif);
+		if (ret && list_empty(&vif->notify_list))
+			list_add_tail(&vif->notify_list, &notify);
+		else
+			xenvif_put(vif);
 		npo.meta_cons += sco->meta_slots_used;
 		dev_kfree_skb(skb);
 	}
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct x
 	list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
 		notify_remote_via_irq(vif->irq);
 		list_del_init(&vif->notify_list);
+		xenvif_put(vif);
 	}
 
 	/* More work to do? */
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

Acked-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 8 lines · Jan Beulich

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

maintainer
#3 lore raw
In reply to Jan Beulich

From: "Jan Beulich" <[email protected]>
Date: Wed, 05 Jun 2013 15:03:11 +0100

Quoted 8 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

You've included the commit message, and the patch, twice. Once inline and once as an attachment, do not do this. It makes the patch impossible to apply when I fetch it out of patchwork.

Please submit it properly.

maintainer
#4 lore raw
In reply to Jan Beulich

From: "Jan Beulich" <[email protected]>
Date: Wed, 05 Jun 2013 15:03:11 +0100

Quoted 8 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

You've included the commit message, and the patch, twice. Once inline and once as an attachment, do not do this. It makes the patch impossible to apply when I fetch it out of patchwork.

Please submit it properly.

#5 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · David Miller

From: "Jan Beulich" <[email protected]>
Date: Wed, 05 Jun 2013 15:03:11 +0100

Quoted 7 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

Quoted 7 lines
Quoted 1 line

You've included the commit message, and the patch, twice. Once inline and once as an attachment, do not do this. It makes the patch impossible to apply when I fetch it out of patchwork.

Please submit it properly.

Sending to multiple lists makes it impossible to match everyone's preferences/requirements. xen-devel generally wants patches inline and attached (for the case where the inline variant gets mangled by mail programs).

I'll resend inline only, in the hope that it'll reach your inbox intact.

Jan

#6 lore raw
In reply to David Miller
Quoted 11 lines
Quoted 1 line
Quoted 1 line · David Miller

From: "Jan Beulich" <[email protected]>
Date: Wed, 05 Jun 2013 15:03:11 +0100

Quoted 7 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

Quoted 7 lines
Quoted 1 line

You've included the commit message, and the patch, twice. Once inline and once as an attachment, do not do this. It makes the patch impossible to apply when I fetch it out of patchwork.

Please submit it properly.

Sending to multiple lists makes it impossible to match everyone's preferences/requirements. xen-devel generally wants patches inline and attached (for the case where the inline variant gets mangled by mail programs).

I'll resend inline only, in the hope that it'll reach your inbox intact.

Jan

#9 lore raw

PATCH RESEND 1/1 xen-netback: don't de-reference vif pointer after having called xenvif_put()

In reply to David Miller

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

---
 drivers/net/xen-netback/netback.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/xen-netback/netback.c +6 -5
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct x
 {
 	struct xenvif *vif = NULL, *tmp;
 	s8 status;
-	u16 irq, flags;
+	u16 flags;
 	struct xen_netif_rx_response *resp;
 	struct sk_buff_head rxq;
 	struct sk_buff *skb;
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct x
 					 sco->meta_slots_used);
 
 		RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
-		irq = vif->irq;
-		if (ret && list_empty(&vif->notify_list))
-			list_add_tail(&vif->notify_list, &notify);
 
 		xenvif_notify_tx_completion(vif);
 
-		xenvif_put(vif);
+		if (ret && list_empty(&vif->notify_list))
+			list_add_tail(&vif->notify_list, &notify);
+		else
+			xenvif_put(vif);
 		npo.meta_cons += sco->meta_slots_used;
 		dev_kfree_skb(skb);
 	}
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct x
 	list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
 		notify_remote_via_irq(vif->irq);
 		list_del_init(&vif->notify_list);
+		xenvif_put(vif);
 	}
 
 	/* More work to do? */
#10 lore raw

PATCH RESEND 1/1 xen-netback: don't de-reference vif pointer after having called xenvif_put()

In reply to David Miller

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

---
 drivers/net/xen-netback/netback.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/xen-netback/netback.c +6 -5
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct x
 {
 	struct xenvif *vif = NULL, *tmp;
 	s8 status;
-	u16 irq, flags;
+	u16 flags;
 	struct xen_netif_rx_response *resp;
 	struct sk_buff_head rxq;
 	struct sk_buff *skb;
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct x
 					 sco->meta_slots_used);
 
 		RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
-		irq = vif->irq;
-		if (ret && list_empty(&vif->notify_list))
-			list_add_tail(&vif->notify_list, &notify);
 
 		xenvif_notify_tx_completion(vif);
 
-		xenvif_put(vif);
+		if (ret && list_empty(&vif->notify_list))
+			list_add_tail(&vif->notify_list, &notify);
+		else
+			xenvif_put(vif);
 		npo.meta_cons += sco->meta_slots_used;
 		dev_kfree_skb(skb);
 	}
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct x
 	list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
 		notify_remote_via_irq(vif->irq);
 		list_del_init(&vif->notify_list);
+		xenvif_put(vif);
 	}
 
 	/* More work to do? */
maintainer
#7 lore raw
In reply to Jan Beulich

From: "Jan Beulich" <[email protected]>
Date: Tue, 11 Jun 2013 10:59:39 +0100

Quoted 17 lines
Quoted 17 lines
Quoted 1 line
Quoted 1 line · David Miller

From: "Jan Beulich" <[email protected]>
Date: Wed, 05 Jun 2013 15:03:11 +0100

Quoted 8 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

You've included the commit message, and the patch, twice. Once inline and once as an attachment, do not do this. It makes the patch impossible to apply when I fetch it out of patchwork.

Quoted 6 lines
Quoted 1 line

Please submit it properly.

Sending to multiple lists makes it impossible to match everyone's preferences/requirements. xen-devel generally wants patches inline and attached (for the case where the inline variant gets mangled by mail programs).

That's rediculous. Fix your mail client setup, and send it inline only.

Otherwise people can't reply and comment inline to the content of your patch properly.

maintainer
#8 lore raw
In reply to Jan Beulich

From: "Jan Beulich" <[email protected]>
Date: Tue, 11 Jun 2013 10:59:39 +0100

Quoted 17 lines
Quoted 17 lines
Quoted 1 line
Quoted 1 line · David Miller

From: "Jan Beulich" <[email protected]>
Date: Wed, 05 Jun 2013 15:03:11 +0100

Quoted 8 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

You've included the commit message, and the patch, twice. Once inline and once as an attachment, do not do this. It makes the patch impossible to apply when I fetch it out of patchwork.

Quoted 6 lines
Quoted 1 line

Please submit it properly.

Sending to multiple lists makes it impossible to match everyone's preferences/requirements. xen-devel generally wants patches inline and attached (for the case where the inline variant gets mangled by mail programs).

That's rediculous. Fix your mail client setup, and send it inline only.

Otherwise people can't reply and comment inline to the content of your patch properly.

maintainer Applied
#11 lore raw
In reply to Jan Beulich

From: "Jan Beulich" <[email protected]>
Date: Tue, 11 Jun 2013 11:00:34 +0100

Quoted 9 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

Applied.

maintainer Applied
#12 lore raw
In reply to Jan Beulich

From: "Jan Beulich" <[email protected]>
Date: Tue, 11 Jun 2013 11:00:34 +0100

Quoted 9 lines

When putting vif-s on the rx notify list, calling xenvif_put() must be deferred until after the removal from the list and the issuing of the notification, as both operations dereference the pointer.

Changing this got me to notice that the "irq" variable was effectively unused (and was of too narrow type anyway).

Applied.