Skip to content

Commit 234f0cc

Browse files
hagarhemNipaLocal
authored and
NipaLocal
committed
net: esp: cleanup esp_output_tail_tcp() in case of unsupported ESPINTCP
xmit() functions should consume skb or return error codes in error paths. When the configuration "CONFIG_INET_ESPINTCP" is not used, the implementation of the function "esp_output_tail_tcp" violates this rule. The function frees the skb and returns the error code. This change removes the kfree_skb from both functions, for both esp4 and esp6. This should not be reachable in the current code, so this change is just a cleanup. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Fixes: e27cca9 ("xfrm: add espintcp (RFC 8229)") Signed-off-by: Hagar Hemdan <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 23b9e35 commit 234f0cc

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

net/ipv4/esp4.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ static int esp_output_tail_tcp(struct xfrm_state *x, struct sk_buff *skb)
239239
#else
240240
static int esp_output_tail_tcp(struct xfrm_state *x, struct sk_buff *skb)
241241
{
242-
kfree_skb(skb);
243-
242+
WARN_ON(1);
244243
return -EOPNOTSUPP;
245244
}
246245
#endif

net/ipv6/esp6.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ static int esp_output_tail_tcp(struct xfrm_state *x, struct sk_buff *skb)
256256
#else
257257
static int esp_output_tail_tcp(struct xfrm_state *x, struct sk_buff *skb)
258258
{
259-
kfree_skb(skb);
260-
259+
WARN_ON(1);
261260
return -EOPNOTSUPP;
262261
}
263262
#endif

0 commit comments

Comments
 (0)