mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@codeconstruct.com.au>
To: Joas Antonio dos Santos <joasantonio108@gmail.com>
Cc: Matt Johnston <matt@codeconstruct.com.au>,
	Guikun Yang <yangguikun19@qq.com>,
	 "David S.Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: mctp: free reassembly head skb when key_add fails on SOM
Date: Wed, 28 Oct 2026 08:25:47 +0800	[thread overview]
Message-ID: <8610ff0f3852f68c935f5234ea0236f89f7c0131.camel@codeconstruct.com.au> (raw)
In-Reply-To: <179301733329.91976.14585535037608378942@gmail.com>

Hi Joas,

> > We could just defer setting skb to NULL until the mctp_key_add() has
> > succeeded; there's already the common error path that cleans up any
> > remaining skb.
> 
> I think that one needs care. For the first fragment, mctp_frag_queue()
> stores skb_unclone_full(skb) in key->reasm_head, and if skb is a clone,
> skb_unclone_full() frees it and returns a copy. The kfree_skb(skb) at
> out: would then free the original a second time, and the copy in
> reasm_head would still leak. Taking skb back from key->reasm_head on
> failure would work, but the explicit free looked simpler to me.

OK, yep, that makes sense!

Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>

Cheers,


Jeremy

      reply	other threads:[~2026-10-28  0:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 22:04 Joas Antonio dos Santos
2026-10-26  7:12 ` Jeremy Kerr
2026-10-26 12:22   ` Joas Antonio dos Santos
2026-10-28  0:25     ` Jeremy Kerr [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8610ff0f3852f68c935f5234ea0236f89f7c0131.camel@codeconstruct.com.au \
    --to=jk@codeconstruct.com.au \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=joasantonio108@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yangguikun19@qq.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®