Commit e5ccd961 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ehea: fix use after free

ehea_start_xmit() dereferences skb after its freeing in ehea_xmit3() to
get vlan tags.

Move the offending block before the potential ehea_xmit3() call.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarBreno Leitao <leitao@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b914c4ea
...@@ -2249,6 +2249,11 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2249,6 +2249,11 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
memset(swqe, 0, SWQE_HEADER_SIZE); memset(swqe, 0, SWQE_HEADER_SIZE);
atomic_dec(&pr->swqe_avail); atomic_dec(&pr->swqe_avail);
if (vlan_tx_tag_present(skb)) {
swqe->tx_control |= EHEA_SWQE_VLAN_INSERT;
swqe->vlan_tag = vlan_tx_tag_get(skb);
}
if (skb->len <= SWQE3_MAX_IMM) { if (skb->len <= SWQE3_MAX_IMM) {
u32 sig_iv = port->sig_comp_iv; u32 sig_iv = port->sig_comp_iv;
u32 swqe_num = pr->swqe_id_counter; u32 swqe_num = pr->swqe_id_counter;
...@@ -2279,11 +2284,6 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2279,11 +2284,6 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
pr->swqe_id_counter += 1; pr->swqe_id_counter += 1;
if (vlan_tx_tag_present(skb)) {
swqe->tx_control |= EHEA_SWQE_VLAN_INSERT;
swqe->vlan_tag = vlan_tx_tag_get(skb);
}
if (netif_msg_tx_queued(port)) { if (netif_msg_tx_queued(port)) {
ehea_info("post swqe on QP %d", pr->qp->init_attr.qp_nr); ehea_info("post swqe on QP %d", pr->qp->init_attr.qp_nr);
ehea_dump(swqe, 512, "swqe"); ehea_dump(swqe, 512, "swqe");
......
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