diff options
author | 2024-07-04 15:19:33 +0200 | |
---|---|---|
committer | 2024-07-04 15:19:33 +0200 | |
commit | afeea2758b4f1210361ce2a91d8fa3e7df606ad2 (patch) | |
tree | 969164f4e52fac6d4ec7d275540e702375e80950 /net/tipc/msg.c | |
parent | drm/komeda: remove unused struct 'gamma_curve_segment' (diff) | |
parent | drm/panthor: Record devfreq busy as soon as a job is started (diff) | |
download | wireguard-linux-afeea2758b4f1210361ce2a91d8fa3e7df606ad2.tar.xz wireguard-linux-afeea2758b4f1210361ce2a91d8fa3e7df606ad2.zip |
Merge drm-misc-next-2024-07-04 into drm-misc-next-fixes
Let's start the drm-misc-next-fixes cycle.
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'net/tipc/msg.c')
-rw-r--r-- | net/tipc/msg.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 5c9fd4791c4b..76284fc538eb 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -142,9 +142,9 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) if (fragid == FIRST_FRAGMENT) { if (unlikely(head)) goto err; - *buf = NULL; if (skb_has_frag_list(frag) && __skb_linearize(frag)) goto err; + *buf = NULL; frag = skb_unshare(frag, GFP_ATOMIC); if (unlikely(!frag)) goto err; @@ -156,6 +156,11 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) if (!head) goto err; + /* Either the input skb ownership is transferred to headskb + * or the input skb is freed, clear the reference to avoid + * bad access on error path. + */ + *buf = NULL; if (skb_try_coalesce(head, frag, &headstolen, &delta)) { kfree_skb_partial(frag, headstolen); } else { @@ -179,7 +184,6 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) *headbuf = NULL; return 1; } - *buf = NULL; return 0; err: kfree_skb(*buf); |