Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/hsr: Check skb_put_padto() return value

skb_put_padto() will free the sk_buff passed as reference in case of
errors, but we still need to check its return value and decide what to
do.

Detected by CoverityScan, CID#1416688 ("CHECKED_RETURN")

Fixes: ee1c27977284 ("net/hsr: Added support for HSR v1")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
414e7d76 c5cff856

+2 -1
+2 -1
net/hsr/hsr_device.c
··· 314 314 hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload)); 315 315 ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr); 316 316 317 - skb_put_padto(skb, ETH_ZLEN + HSR_HLEN); 317 + if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN)) 318 + return; 318 319 319 320 hsr_forward_skb(skb, master); 320 321 return;