Commit f342eb2
rxrpc: Fix potential UAF after skb_unshare() failure
cve-pre CVE-2026-43500
commit-author David Howells <dhowells@redhat.com>
commit 1f27401
upstream-diff |
Upstream's rxrpc_input_call_event() pulls skbs from a per-call queue
in a loop, so the unshare block sits inside that loop alongside
rxrpc_free_skb() and saw_ack bookkeeping. This kernel's version
receives a single skb as a function parameter and doesn't free
it (the caller in rxrpc_io_thread() does). As such, the adapted
unshare block wraps the existing rxrpc_input_call_packet() call
site, creates and frees a copy when needed, and drops the loop
and queue-drain logic that doesn't exist here.
Upstream already had rxrpc_skb_put_call_rx and rxrpc_skb_get_call_rx
trace constants from a prior refactor not present in this tree.
rxrpc_skb_put_call_rx is added here since the new skb_copy path
needs it; rxrpc_skb_get_call_rx is omitted since nothing uses it.
Several trace constants added by upstream (rxrpc_skb_put_purge_oob,
rxrpc_skb_put_response, rxrpc_skb_put_response_copy) don't apply
since the code they trace doesn't exist in this kernel.
Note, Conflict caused by 153f90a
("rxrpc: Use ktimes for call timeout tracking and set the timer lazily").
If skb_unshare() fails to unshare a packet due to allocation failure in
rxrpc_input_packet(), the skb pointer in the parent (rxrpc_io_thread())
will be NULL'd out. This will likely cause the call to
trace_rxrpc_rx_done() to oops.
Fix this by moving the unsharing down to where rxrpc_input_call_event()
calls rxrpc_input_call_packet(). There are a number of places prior to
that where we ignore DATA packets for a variety of reasons (such as the
call already being complete) for which an unshare is then avoided.
And with that, rxrpc_input_packet() doesn't need to take a pointer to the
pointer to the packet, so change that to just a pointer.
Fixes: 2d1faf7 ("rxrpc: Simplify skbuff accounting in receive path")
Closes: https://sashiko.dev/#/patchset/20260408121252.2249051-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/20260422161438.2593376-4-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 1f27401)
Signed-off-by: Sultan Alsawaf <sultan@ciq.com>
Signed-off-by: Shreeya Patel <spatel@ciq.com>
Signed-off-by: Shreeya Patel <spatel@ciq.com>1 parent 1521408 commit f342eb2
5 files changed
Lines changed: 25 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | 129 | | |
132 | 130 | | |
133 | 131 | | |
| |||
139 | 137 | | |
140 | 138 | | |
141 | 139 | | |
| 140 | + | |
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
| |||
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1253 | 1253 | | |
1254 | 1254 | | |
1255 | 1255 | | |
1256 | | - | |
1257 | 1256 | | |
1258 | 1257 | | |
1259 | 1258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
346 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
347 | 366 | | |
348 | 367 | | |
349 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
| |||
220 | 219 | | |
221 | 220 | | |
222 | 221 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | 222 | | |
243 | 223 | | |
244 | 224 | | |
| |||
476 | 456 | | |
477 | 457 | | |
478 | 458 | | |
479 | | - | |
| 459 | + | |
480 | 460 | | |
481 | 461 | | |
482 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 49 | | |
59 | 50 | | |
60 | 51 | | |
| |||
0 commit comments