From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
Jeffrey Altman <jaltman@auristor.com>,
Simon Horman <horms@kernel.org>,
linux-afs@lists.infradead.org, stable@kernel.org,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 6.19 80/86] rxrpc: Fix missing error checks for rxkad encryption/decryption failure
Date: Mon, 13 Apr 2026 18:00:27 +0200 [thread overview]
Message-ID: <20260413155734.526069657@linuxfoundation.org> (raw)
In-Reply-To: <20260413155731.568515178@linuxfoundation.org>
6.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <dhowells@redhat.com>
commit f93af41b9f5f798823d0d0fb8765c2a936d76270 upstream.
Add error checking for failure of crypto_skcipher_en/decrypt() to various
rxkad function as the crypto functions can fail with ENOMEM at least.
Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Closes: https://sashiko.dev/#/patchset/20260401105614.1696001-10-dhowells@redhat.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/20260408121252.2249051-17-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/rxrpc/rxkad.c | 57 ++++++++++++++++++++++++++++++++++++------------------
1 file changed, 38 insertions(+), 19 deletions(-)
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -197,6 +197,7 @@ static int rxkad_prime_packet_security(s
struct rxrpc_crypt iv;
__be32 *tmpbuf;
size_t tmpsize = 4 * sizeof(__be32);
+ int ret;
_enter("");
@@ -225,13 +226,13 @@ static int rxkad_prime_packet_security(s
skcipher_request_set_sync_tfm(req, ci);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, &sg, &sg, tmpsize, iv.x);
- crypto_skcipher_encrypt(req);
+ ret = crypto_skcipher_encrypt(req);
skcipher_request_free(req);
memcpy(&conn->rxkad.csum_iv, tmpbuf + 2, sizeof(conn->rxkad.csum_iv));
kfree(tmpbuf);
- _leave(" = 0");
- return 0;
+ _leave(" = %d", ret);
+ return ret;
}
/*
@@ -264,6 +265,7 @@ static int rxkad_secure_packet_auth(cons
struct scatterlist sg;
size_t pad;
u16 check;
+ int ret;
_enter("");
@@ -286,11 +288,11 @@ static int rxkad_secure_packet_auth(cons
skcipher_request_set_sync_tfm(req, call->conn->rxkad.cipher);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, &sg, &sg, 8, iv.x);
- crypto_skcipher_encrypt(req);
+ ret = crypto_skcipher_encrypt(req);
skcipher_request_zero(req);
- _leave(" = 0");
- return 0;
+ _leave(" = %d", ret);
+ return ret;
}
/*
@@ -345,7 +347,7 @@ static int rxkad_secure_packet(struct rx
union {
__be32 buf[2];
} crypto __aligned(8);
- u32 x, y;
+ u32 x, y = 0;
int ret;
_enter("{%d{%x}},{#%u},%u,",
@@ -376,8 +378,10 @@ static int rxkad_secure_packet(struct rx
skcipher_request_set_sync_tfm(req, call->conn->rxkad.cipher);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, &sg, &sg, 8, iv.x);
- crypto_skcipher_encrypt(req);
+ ret = crypto_skcipher_encrypt(req);
skcipher_request_zero(req);
+ if (ret < 0)
+ goto out;
y = ntohl(crypto.buf[1]);
y = (y >> 16) & 0xffff;
@@ -413,6 +417,7 @@ static int rxkad_secure_packet(struct rx
memset(p + txb->pkt_len, 0, gap);
}
+out:
skcipher_request_free(req);
_leave(" = %d [set %x]", ret, y);
return ret;
@@ -453,8 +458,10 @@ static int rxkad_verify_packet_1(struct
skcipher_request_set_sync_tfm(req, call->conn->rxkad.cipher);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, sg, sg, 8, iv.x);
- crypto_skcipher_decrypt(req);
+ ret = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
+ if (ret < 0)
+ return ret;
/* Extract the decrypted packet length */
if (skb_copy_bits(skb, sp->offset, &sechdr, sizeof(sechdr)) < 0)
@@ -531,10 +538,14 @@ static int rxkad_verify_packet_2(struct
skcipher_request_set_sync_tfm(req, call->conn->rxkad.cipher);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, sg, sg, sp->len, iv.x);
- crypto_skcipher_decrypt(req);
+ ret = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
if (sg != _sg)
kfree(sg);
+ if (ret < 0) {
+ WARN_ON_ONCE(ret != -ENOMEM);
+ return ret;
+ }
/* Extract the decrypted packet length */
if (skb_copy_bits(skb, sp->offset, &sechdr, sizeof(sechdr)) < 0)
@@ -602,8 +613,10 @@ static int rxkad_verify_packet(struct rx
skcipher_request_set_sync_tfm(req, call->conn->rxkad.cipher);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, &sg, &sg, 8, iv.x);
- crypto_skcipher_encrypt(req);
+ ret = crypto_skcipher_encrypt(req);
skcipher_request_zero(req);
+ if (ret < 0)
+ goto out;
y = ntohl(crypto.buf[1]);
cksum = (y >> 16) & 0xffff;
@@ -1077,21 +1090,23 @@ static int rxkad_decrypt_ticket(struct r
/*
* decrypt the response packet
*/
-static void rxkad_decrypt_response(struct rxrpc_connection *conn,
- struct rxkad_response *resp,
- const struct rxrpc_crypt *session_key)
+static int rxkad_decrypt_response(struct rxrpc_connection *conn,
+ struct rxkad_response *resp,
+ const struct rxrpc_crypt *session_key)
{
struct skcipher_request *req = rxkad_ci_req;
struct scatterlist sg[1];
struct rxrpc_crypt iv;
+ int ret;
_enter(",,%08x%08x",
ntohl(session_key->n[0]), ntohl(session_key->n[1]));
mutex_lock(&rxkad_ci_mutex);
- if (crypto_sync_skcipher_setkey(rxkad_ci, session_key->x,
- sizeof(*session_key)) < 0)
- BUG();
+ ret = crypto_sync_skcipher_setkey(rxkad_ci, session_key->x,
+ sizeof(*session_key));
+ if (ret < 0)
+ goto unlock;
memcpy(&iv, session_key, sizeof(iv));
@@ -1100,12 +1115,14 @@ static void rxkad_decrypt_response(struc
skcipher_request_set_sync_tfm(req, rxkad_ci);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, sg, sg, sizeof(resp->encrypted), iv.x);
- crypto_skcipher_decrypt(req);
+ ret = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
+unlock:
mutex_unlock(&rxkad_ci_mutex);
_leave("");
+ return ret;
}
/*
@@ -1198,7 +1215,9 @@ static int rxkad_verify_response(struct
/* use the session key from inside the ticket to decrypt the
* response */
- rxkad_decrypt_response(conn, response, &session_key);
+ ret = rxkad_decrypt_response(conn, response, &session_key);
+ if (ret < 0)
+ goto temporary_error_free_ticket;
if (ntohl(response->encrypted.epoch) != conn->proto.epoch ||
ntohl(response->encrypted.cid) != conn->proto.cid ||
next prev parent reply other threads:[~2026-04-13 16:06 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 15:59 [PATCH 6.19 00/86] 6.19.13-rc1 review Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 01/86] usb: typec: ucsi: skip connector validation before init Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 02/86] wifi: rt2x00usb: fix devres lifetime Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 03/86] xfrm_user: fix info leak in build_report() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 04/86] net: rfkill: prevent unlimited numbers of rfkill events from being created Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 05/86] Revert "ALSA: hda/realtek: Add quirk for Gigabyte Technology to fix headphone" Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 06/86] ALSA: hda/intel: enforce stricter period-size alignment for Intel NVL Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 07/86] Revert "mptcp: add needs_id for netlink appending addr" Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 08/86] mptcp: fix slab-use-after-free in __inet_lookup_established Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 09/86] seg6: separate dst_cache for input and output paths in seg6 lwtunnel Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 10/86] Input: uinput - fix circular locking dependency with ff-core Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 11/86] Input: uinput - take event lock when submitting FF request "event" Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 12/86] MIPS: Always record SEGBITS in cpu_data.vmbits Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 13/86] MIPS: mm: Suppress TLB uniquification on EHINV hardware Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 14/86] MIPS: mm: Rewrite TLB uniquification for the hidden bit feature Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 15/86] btrfs: remove pointless out labels from extent-tree.c Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 16/86] btrfs: fix incorrect return value after changing leaf in lookup_extent_data_ref() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 17/86] i2c: imx: zero-initialize dma_slave_config for eDMA Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 18/86] netfilter: nft_ct: fix use-after-free in timeout object destroy Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 19/86] firmware: thead: Fix buffer overflow and use standard endian macros Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 20/86] workqueue: Add pool_workqueue to pending_pwqs list when unplugging multiple inactive works Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 21/86] modpost: Declare extra_warn with unused attribute Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 22/86] xfrm: clear trailing padding in build_polexpire() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 23/86] xfrm: hold dev ref until after transport_finish NF_HOOK Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 24/86] tipc: fix bc_ackers underflow on duplicate GRP_ACK_MSG Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 25/86] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 26/86] ASoC: SOF: Intel: hda: modify period size constraints for ACE4 Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 27/86] wifi: brcmsmac: Fix dma_free_coherent() size Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 28/86] x86/mce/amd: Filter bogus hardware errors on Zen3 clients Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 29/86] platform/x86: ISST: Reset core count to 0 Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 30/86] platform/x86/intel-uncore-freq: Handle autonomous UFS status bit Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 31/86] Revert "arm64: dts: rockchip: Further describe the WiFi for the Pinebook Pro" Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 32/86] Revert "arm64: dts: imx8mq-librem5: Set the DVS voltages lower" Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 33/86] arm64: dts: imx8mq-librem5: Bump BUCK1 suspend voltage up to 0.85V Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 34/86] arm64: dts: renesas: sparrow-hawk: Reserve first 128 MiB of DRAM Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 35/86] arm64: dts: hisilicon: poplar: Correct PCIe reset GPIO polarity Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 36/86] arm64: dts: hisilicon: hi3798cv200: Add missing dma-ranges Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 37/86] liveupdate: propagate file deserialization failures Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 38/86] nfc: pn533: allocate rx skb before consuming bytes Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 39/86] batman-adv: reject oversized global TT response buffers Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 40/86] X.509: Fix out-of-bounds access when parsing extensions Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 41/86] EDAC/mc: Fix error path ordering in edac_mc_alloc() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 42/86] net/tls: fix use-after-free in -EBUSY error path of tls_do_encryption Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 43/86] net: altera-tse: fix skb leak on DMA mapping error in tse_start_xmit() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 44/86] batman-adv: hold claim backbone gateways by reference Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 45/86] drm/i915/gt: fix refcount underflow in intel_engine_park_heartbeat Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 46/86] drm/i915/psr: Do not use pipe_src as borders for SU area Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 47/86] net/mlx5: Update the list of the PCI supported devices Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 48/86] pmdomain: imx8mp-blk-ctrl: Keep the NOC_HDCP clock enabled Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 49/86] igb: remove napi_synchronize() in igb_down() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 50/86] mm/vma: fix memory leak in __mmap_region() Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 51/86] mm/memory_hotplug: maintain N_NORMAL_MEMORY during hotplug Greg Kroah-Hartman
2026-04-13 15:59 ` [PATCH 6.19 52/86] mm/damon/sysfs: dealloc repeat_call_control if damon_call() fails Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 53/86] mm/damon/stat: deallocate damon_call() failure leaking damon_ctx Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 54/86] mmc: vub300: fix NULL-deref on disconnect Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 55/86] mmc: vub300: fix use-after-free " Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 56/86] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 57/86] net: stmmac: fix integer underflow in chain mode Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 58/86] mm: filemap: fix nr_pages calculation overflow in filemap_map_pages() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 59/86] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 60/86] idpf: improve locking around idpf_vc_xn_push_free() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 61/86] idpf: set the payload size before calling the async handler Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 62/86] net: lan966x: fix page_pool error handling in lan966x_fdma_rx_alloc_page_pool() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 63/86] net: lan966x: fix page pool leak in error paths Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 64/86] net: lan966x: fix use-after-free and leak in lan966x_fdma_reload() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 65/86] rxrpc: Fix key quota calculation for multitoken keys Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 66/86] rxrpc: Fix key parsing memleak Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 67/86] rxrpc: Fix anonymous key handling Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 68/86] rxrpc: Fix call removal to use RCU safe deletion Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 69/86] rxrpc: Fix RxGK token loading to check bounds Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 70/86] rxrpc: Fix use of wrong skb when comparing queued RESP challenge serial Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 71/86] rxrpc: Fix rack timer warning to report unexpected mode Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 72/86] rxrpc: Fix key reference count leak from call->key Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 73/86] rxrpc: Fix to request an ack if window is limited Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 74/86] rxrpc: Only put the call ref if one was acquired Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 75/86] rxrpc: reject undecryptable rxkad response tickets Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 76/86] rxrpc: fix RESPONSE authenticator parser OOB read Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 77/86] rxrpc: fix oversized RESPONSE authenticator length check Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 78/86] rxrpc: fix reference count leak in rxrpc_server_keyring() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 79/86] rxrpc: Fix key/keyring checks in setsockopt(RXRPC_SECURITY_KEY/KEYRING) Greg Kroah-Hartman
2026-04-13 16:00 ` Greg Kroah-Hartman [this message]
2026-04-13 16:00 ` [PATCH 6.19 81/86] rxrpc: Fix integer overflow in rxgk_verify_response() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 82/86] rxrpc: Fix leak of rxgk context " Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 83/86] rxrpc: Fix buffer overread in rxgk_do_verify_authenticator() Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 84/86] rxrpc: only handle RESPONSE during service challenge Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 85/86] rxrpc: proc: size address buffers for %pISpc output Greg Kroah-Hartman
2026-04-13 16:00 ` [PATCH 6.19 86/86] net: skb: fix cross-cache free of KFENCE-allocated skb head Greg Kroah-Hartman
2026-04-13 17:01 ` [PATCH 6.19 00/86] 6.19.13-rc1 review Ronald Warsow
2026-04-13 17:43 ` Brett A C Sheffield
2026-04-13 19:46 ` Florian Fainelli
2026-04-14 7:54 ` Jon Hunter
2026-04-14 11:25 ` Ron Economos
2026-04-14 11:26 ` Takeshi Ogasawara
2026-04-14 17:42 ` Shuah Khan
2026-04-14 18:17 ` Mark Brown
2026-04-14 18:21 ` Miguel Ojeda
2026-04-14 23:34 ` Peter Schneider
2026-04-15 2:19 ` Barry K. Nathan
2026-04-15 3:47 ` Shung-Hsi Yu
2026-04-15 12:26 ` Dileep malepu
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=20260413155734.526069657@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=dhowells@redhat.com \
--cc=horms@kernel.org \
--cc=jaltman@auristor.com \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=marc.dionne@auristor.com \
--cc=patches@lists.linux.dev \
--cc=stable@kernel.org \
--cc=stable@vger.kernel.org \
/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