Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rxrpc: Also unshare DATA/RESPONSE packets when paged frags are present

The DATA-packet handler in rxrpc_input_call_event() and the RESPONSE
handler in rxrpc_verify_response() copy the skb to a linear one before
calling into the security ops only when skb_cloned() is true. An skb
that is not cloned but still carries externally-owned paged fragments
(e.g. SKBFL_SHARED_FRAG set by splice() into a UDP socket via
__ip_append_data, or a chained skb_has_frag_list()) falls through to
the in-place decryption path, which binds the frag pages directly into
the AEAD/skcipher SGL via skb_to_sgvec().

Extend the gate to also unshare when skb_has_frag_list() or
skb_has_shared_frag() is true. This catches the splice-loopback vector
and other externally-shared frag sources while preserving the
zero-copy fast path for skbs whose frags are kernel-private (e.g. NIC
page_pool RX, GRO). The OOM/trace handling already in place is reused.

Fixes: d0d5c0cd1e71 ("rxrpc: Use skb_unshare() rather than skb_cow_data()")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hyunwoo Kim and committed by
Linus Torvalds
aa54b1d2 a1a10cdb

+5 -2
+3 -1
net/rxrpc/call_event.c
··· 334 334 335 335 if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA && 336 336 sp->hdr.securityIndex != 0 && 337 - skb_cloned(skb)) { 337 + (skb_cloned(skb) || 338 + skb_has_frag_list(skb) || 339 + skb_has_shared_frag(skb))) { 338 340 /* Unshare the packet so that it can be 339 341 * modified by in-place decryption. 340 342 */
+2 -1
net/rxrpc/conn_event.c
··· 245 245 { 246 246 int ret; 247 247 248 - if (skb_cloned(skb)) { 248 + if (skb_cloned(skb) || skb_has_frag_list(skb) || 249 + skb_has_shared_frag(skb)) { 249 250 /* Copy the packet if shared so that we can do in-place 250 251 * decryption. 251 252 */