Skip to content

Commit d472b3a

Browse files
jgross1davem330
authored andcommitted
xen/netfront: don't cache skb_shinfo()
skb_shinfo() can change when calling __pskb_pull_tail(): Don't cache its return value. Cc: [email protected] Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Wei Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 556fdd8 commit d472b3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/xen-netfront.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
894894
struct sk_buff *skb,
895895
struct sk_buff_head *list)
896896
{
897-
struct skb_shared_info *shinfo = skb_shinfo(skb);
898897
RING_IDX cons = queue->rx.rsp_cons;
899898
struct sk_buff *nskb;
900899

@@ -903,15 +902,16 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
903902
RING_GET_RESPONSE(&queue->rx, ++cons);
904903
skb_frag_t *nfrag = &skb_shinfo(nskb)->frags[0];
905904

906-
if (shinfo->nr_frags == MAX_SKB_FRAGS) {
905+
if (skb_shinfo(skb)->nr_frags == MAX_SKB_FRAGS) {
907906
unsigned int pull_to = NETFRONT_SKB_CB(skb)->pull_to;
908907

909908
BUG_ON(pull_to <= skb_headlen(skb));
910909
__pskb_pull_tail(skb, pull_to - skb_headlen(skb));
911910
}
912-
BUG_ON(shinfo->nr_frags >= MAX_SKB_FRAGS);
911+
BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS);
913912

914-
skb_add_rx_frag(skb, shinfo->nr_frags, skb_frag_page(nfrag),
913+
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
914+
skb_frag_page(nfrag),
915915
rx->offset, rx->status, PAGE_SIZE);
916916

917917
skb_shinfo(nskb)->nr_frags = 0;

0 commit comments

Comments
 (0)