Skip to content

Commit 78a93c3

Browse files
AnnYugawadavem330
authored andcommitted
drivers: net: fix return value check in emac_tso_csum()
in emac_tso_csum(), return an error code if an unexpected value is returned by pskb_trim(). Signed-off-by: Yuanjun Gong <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4258faa commit 78a93c3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/net/ethernet/qualcomm/emac/emac-mac.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,11 @@ static int emac_tso_csum(struct emac_adapter *adpt,
12601260
if (skb->protocol == htons(ETH_P_IP)) {
12611261
u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data)
12621262
+ ntohs(ip_hdr(skb)->tot_len);
1263-
if (skb->len > pkt_len)
1264-
pskb_trim(skb, pkt_len);
1263+
if (skb->len > pkt_len) {
1264+
ret = pskb_trim(skb, pkt_len);
1265+
if (unlikely(ret))
1266+
return ret;
1267+
}
12651268
}
12661269

12671270
hdr_len = skb_tcp_all_headers(skb);

0 commit comments

Comments
 (0)