Commit 5c699fb7 authored by Tomasz Gregorek's avatar Tomasz Gregorek Committed by David S. Miller

caif: Fix memory leakage in the chnl_net.c.

Added kfree_skb() calls in the chnk_net.c file on
the error paths.
Signed-off-by: default avatarSjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c9be48dc
...@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) ...@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
skb->protocol = htons(ETH_P_IPV6); skb->protocol = htons(ETH_P_IPV6);
break; break;
default: default:
kfree_skb(skb);
priv->netdev->stats.rx_errors++; priv->netdev->stats.rx_errors++;
return -EINVAL; return -EINVAL;
} }
...@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (skb->len > priv->netdev->mtu) { if (skb->len > priv->netdev->mtu) {
pr_warn("Size of skb exceeded MTU\n"); pr_warn("Size of skb exceeded MTU\n");
kfree_skb(skb);
dev->stats.tx_errors++; dev->stats.tx_errors++;
return -ENOSPC; return NETDEV_TX_OK;
} }
if (!priv->flowenabled) { if (!priv->flowenabled) {
pr_debug("dropping packets flow off\n"); pr_debug("dropping packets flow off\n");
kfree_skb(skb);
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
return NETDEV_TX_BUSY; return NETDEV_TX_OK;
} }
if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP)
...@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); result = priv->chnl.dn->transmit(priv->chnl.dn, pkt);
if (result) { if (result) {
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
return result; return NETDEV_TX_OK;
} }
/* Update statistics. */ /* Update statistics. */
......
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