Commit c0f53771 authored by Pan Bian's avatar Pan Bian Committed by David S. Miller

liquidio: read sc->iq_no before release sc

The function lio_vf_rep_packet_sent_callback releases the occupation of
sc via octeon_free_soft_command. sc should not be used after that.
Unfortunately, sc->iq_no is read. To fix this, the patch stores sc->iq_no
into a local variable before releasing sc and then uses the local variable
instead of sc->iq_no.
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ef6fcd45
...@@ -349,13 +349,15 @@ lio_vf_rep_packet_sent_callback(struct octeon_device *oct, ...@@ -349,13 +349,15 @@ lio_vf_rep_packet_sent_callback(struct octeon_device *oct,
struct octeon_soft_command *sc = (struct octeon_soft_command *)buf; struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
struct sk_buff *skb = sc->ctxptr; struct sk_buff *skb = sc->ctxptr;
struct net_device *ndev = skb->dev; struct net_device *ndev = skb->dev;
u32 iq_no;
dma_unmap_single(&oct->pci_dev->dev, sc->dmadptr, dma_unmap_single(&oct->pci_dev->dev, sc->dmadptr,
sc->datasize, DMA_TO_DEVICE); sc->datasize, DMA_TO_DEVICE);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
iq_no = sc->iq_no;
octeon_free_soft_command(oct, sc); octeon_free_soft_command(oct, sc);
if (octnet_iq_is_full(oct, sc->iq_no)) if (octnet_iq_is_full(oct, iq_no))
return; return;
if (netif_queue_stopped(ndev)) if (netif_queue_stopped(ndev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment