From: Nicolai Buchwitz <nb@tipi-net.de>
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: Sunil Goutham <sgoutham@marvell.com>,
Geetha sowjanya <gakula@marvell.com>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Bharat Bhushan <bbhushan2@marvell.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"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] octeontx2-pf: fix skb use-after-free with ipsec crypto offload
Date: Wed, 21 Oct 2026 08:59:27 +0200 [thread overview]
Message-ID: <a790194252203ea6736acc1554206fd2@tipi-net.de> (raw)
In-Reply-To: <atgugPFCpueeAiB8@rkannoth-OptiPlex-7090>
Hi Ratheesh
On 21.10.2026 05:16, Ratheesh Kannoth wrote:
> On 2026-10-19 at 20:34:33, Nicolai Buchwitz (nb@tipi-net.de) wrote:
>> if (!seg) {
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> index 8d2d607bc92f9..4a20d73d27c06 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>> @@ -1205,6 +1205,13 @@ bool otx2_sq_append_skb(void *dev, struct
>> netdev_queue *txq,
>> if (free_desc < otx2_get_sqe_count(pfvf, skb))
>> return false;
>>
>> + /* Crypto hardware need write permission for ipsec crypto offload */
>> + if (unlikely(xfrm_offload(skb)) && skb_cloned(skb) &&
>> + skb_ensure_writable(skb, skb->len)) {
>
> Thanks for the fix!
>
> Just wanted to double-check the behavior of `skb_ensure_writable(skb,
> skb->len)` on a cloned
> SG packet. Does it end up copying the data twice (once via
> `pskb_may_pull()` to linearize into
> the shared buffer, and again via `pskb_expand_head()` into a new
> buffer)?
>
> I'm a bit concerned about potential performance regressions.
No, AFAIU it copies once. On a cloned skb it will be
__pskb_pull_tail()
-> pskb_expand_head()
-> private head, skb->cloned cleared
The frags are copied into that head and skb_ensure_writable() returns.
That matches what the old skb_unshare() did and also only cloned
xfrm skbs take this path.
> [...]
Regards,
Nicolai
next prev parent reply other threads:[~2026-10-21 6:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 15:04 [PATCH net] octeontx2-pf: fix skb use-after-free with ipsec crypto offload Nicolai Buchwitz
2026-10-21 3:16 ` Ratheesh Kannoth
2026-10-21 6:59 ` Nicolai Buchwitz [this message]
2026-10-21 8:19 ` Ratheesh Kannoth
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=a790194252203ea6736acc1554206fd2@tipi-net.de \
--to=nb@tipi-net.de \
--cc=andrew+netdev@lunn.ch \
--cc=bbhushan2@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gakula@marvell.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.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