Skip to content

Commit

Permalink
qeth: l3 fix rcu splat in xmit
Browse files Browse the repository at this point in the history
when use dst_get_neighbour to get neighbour, we need
rcu_read_lock to protect, since dst_get_neighbour uses
rcu_dereference.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Frank Blaschka authored and David S. Miller committed Nov 16, 2011
1 parent 1d50356 commit 1d36cb4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/s390/net/qeth_l3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2756,18 +2756,22 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb)
struct neighbour *n = NULL;
struct dst_entry *dst;

rcu_read_lock();
dst = skb_dst(skb);
if (dst)
n = dst_get_neighbour(dst);
if (n) {
cast_type = n->type;
rcu_read_unlock();
if ((cast_type == RTN_BROADCAST) ||
(cast_type == RTN_MULTICAST) ||
(cast_type == RTN_ANYCAST))
return cast_type;
else
return RTN_UNSPEC;
}
rcu_read_unlock();

/* try something else */
if (skb->protocol == ETH_P_IPV6)
return (skb_network_header(skb)[24] == 0xff) ?
Expand Down Expand Up @@ -2847,6 +2851,8 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
}

hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr);

rcu_read_lock();
dst = skb_dst(skb);
if (dst)
n = dst_get_neighbour(dst);
Expand Down Expand Up @@ -2893,6 +2899,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
QETH_CAST_UNICAST | QETH_HDR_PASSTHRU;
}
}
rcu_read_unlock();
}

static inline void qeth_l3_hdr_csum(struct qeth_card *card,
Expand Down

0 comments on commit 1d36cb4

Please sign in to comment.