Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jan Beulich and committed by
David S. Miller
94f950c4 99ffc3e7

+6 -5
+6 -5
drivers/net/xen-netback/netback.c
··· 662 662 { 663 663 struct xenvif *vif = NULL, *tmp; 664 664 s8 status; 665 - u16 irq, flags; 665 + u16 flags; 666 666 struct xen_netif_rx_response *resp; 667 667 struct sk_buff_head rxq; 668 668 struct sk_buff *skb; ··· 771 771 sco->meta_slots_used); 772 772 773 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 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 781 npo.meta_cons += sco->meta_slots_used; 782 782 dev_kfree_skb(skb); 783 783 } ··· 785 785 list_for_each_entry_safe(vif, tmp, &notify, notify_list) { 786 786 notify_remote_via_irq(vif->irq); 787 787 list_del_init(&vif->notify_list); 788 + xenvif_put(vif); 788 789 } 789 790 790 791 /* More work to do? */