usb: u_ether: Add null pointer check for sk_buff in eth_start_xmit

There is a possibility of null pointer dereference for sk_buff in
the function eth_start_xmit. Fix this by removing sk_buff from if
check at the start of the function eth_start_xmit so that if sk_buff
is null dev_kfree_skb_any will return without proceeding further.

Change-Id: I105e42c59aaa83c8d74cc5a9e894ae4fc87c3c9f
Signed-off-by: Rohith Kollalsi <rkollals@codeaurora.org>
This commit is contained in:
Rohith Kollalsi 2020-07-06 19:00:12 +05:30 • committed by Gerrit - the friendly Code Review server
commit a215b92aa2

View file

@ -490,7 +490,7 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
}
spin_unlock_irqrestore(&dev->lock, flags);
if (skb && !in) {
if (!in) {
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}