Skip to content

Commit ea1ebe6

Browse files
V4beljannau
authored andcommitted
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 paged fragments (skb->data_len != 0) 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 so that any skb with non-linear data is also copied, ensuring the security handler always operates on a fully linear skb. The OOM/trace handling already in place is reused. Fixes: d0d5c0c ("rxrpc: Use skb_unshare() rather than skb_cow_data()") Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
1 parent 9eebd69 commit ea1ebe6

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

net/rxrpc/call_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
334334

335335
if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA &&
336336
sp->hdr.securityIndex != 0 &&
337-
skb_cloned(skb)) {
337+
(skb_cloned(skb) || skb->data_len)) {
338338
/* Unshare the packet so that it can be
339339
* modified by in-place decryption.
340340
*/

net/rxrpc/conn_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static int rxrpc_verify_response(struct rxrpc_connection *conn,
245245
{
246246
int ret;
247247

248-
if (skb_cloned(skb)) {
248+
if (skb_cloned(skb) || skb->data_len) {
249249
/* Copy the packet if shared so that we can do in-place
250250
* decryption.
251251
*/

0 commit comments

Comments
 (0)