aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@suse.com>2013-06-11 06:00:34 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-13 04:25:24 -0400
commit94f950c4060cd9b1989c565284beb159b9705a50 (patch)
treead1501e540db23490a383b14a9af62f6db0ed27f
parent99ffc3e74fb0d9d321d2f19c6021e0dbaff2f4b2 (diff)
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). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/xen-netback/netback.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 37984e6d4e99..8c20935d72c9 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
662{ 662{
663 struct xenvif *vif = NULL, *tmp; 663 struct xenvif *vif = NULL, *tmp;
664 s8 status; 664 s8 status;
665 u16 irq, flags; 665 u16 flags;
666 struct xen_netif_rx_response *resp; 666 struct xen_netif_rx_response *resp;
667 struct sk_buff_head rxq; 667 struct sk_buff_head rxq;
668 struct sk_buff *skb; 668 struct sk_buff *skb;
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
771 sco->meta_slots_used); 771 sco->meta_slots_used);
772 772
773 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret); 773 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret);
774 irq = vif->irq;
775 if (ret && list_empty(&vif->notify_list))
776 list_add_tail(&vif->notify_list, &notify);
777 774
778 xenvif_notify_tx_completion(vif); 775 xenvif_notify_tx_completion(vif);
779 776
780 xenvif_put(vif); 777 if (ret && list_empty(&vif->notify_list))
778 list_add_tail(&vif->notify_list, &notify);
779 else
780 xenvif_put(vif);
781 npo.meta_cons += sco->meta_slots_used; 781 npo.meta_cons += sco->meta_slots_used;
782 dev_kfree_skb(skb); 782 dev_kfree_skb(skb);
783 } 783 }
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk)
785 list_for_each_entry_safe(vif, tmp, &notify, notify_list) { 785 list_for_each_entry_safe(vif, tmp, &notify, notify_list) {
786 notify_remote_via_irq(vif->irq); 786 notify_remote_via_irq(vif->irq);
787 list_del_init(&vif->notify_list); 787 list_del_init(&vif->notify_list);
788 xenvif_put(vif);
788 } 789 }
789 790
790 /* More work to do? */ 791 /* More work to do? */