From nobody Tue Apr 7 12:55:29 2026 Received: from mail-dl1-f41.google.com (mail-dl1-f41.google.com [74.125.82.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADFC63A381A for ; Fri, 13 Mar 2026 13:23:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773408238; cv=none; b=Bqr7bdwSr+MHamRciDKH+D5xDpywJt0Q44vLybLU7S3KqbUYaeVQhCnxDTJwpCHkS5W1NFmNubmY58cWAGxU7WCEpiSHffNhh+N69WORmk6sFDogKI/OqNSvct0Xnp0Fha0S3o26Sx+KfnEejWof0Bt1HFUNEBPsdRp3Zd8Ma+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773408238; c=relaxed/simple; bh=nZ+k6LwmVTzAEw3vuuHe+hasE2D5fqRByDUONeH3iyI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fuWLWjdq/E+aXzcmPAPgNGIdyTZ6vBdqjB3SEEbfkksCpjmL2nr6+8iT3qItge+qtLmUI1nLpVALWgZhV3FdvcCS1HXoFMQijZDgYTN0Dh64Hji0rwv+QGnmOe0sRTDLnk6XEqei6XPiO5bQbKnTgVUCKQ+njwQ/77jCESybtCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=allelesecurity.com; spf=pass smtp.mailfrom=allelesecurity.com; dkim=pass (1024-bit key) header.d=allelesecurity.com header.i=@allelesecurity.com header.b=gmFWOMue; arc=none smtp.client-ip=74.125.82.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=allelesecurity.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=allelesecurity.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=allelesecurity.com header.i=@allelesecurity.com header.b="gmFWOMue" Received: by mail-dl1-f41.google.com with SMTP id a92af1059eb24-128e8ac3330so1163059c88.0 for ; Fri, 13 Mar 2026 06:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=allelesecurity.com; s=google; t=1773408236; x=1774013036; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kTmBFIgmTmliDvtg+vbiajCTqXtJ+XpWwf8ulZ4sMAQ=; b=gmFWOMueFqJt7Vv2JNCkya42Qirwk/73yZbgt4Ee8sRjdXGri8SNkA9em1MCO+ImvW Hmzv8Zz3xCTeMF75DTAaTAkHaEwLgfa4fDT8txR4xZXduGUykPixTNjRHepXDrJWKxGh oeQuq5JofEBXjaCNO897N1rW0imSvBlOYO4JM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773408236; x=1774013036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kTmBFIgmTmliDvtg+vbiajCTqXtJ+XpWwf8ulZ4sMAQ=; b=ZKtTI0bkMUXlfl/I9k9fgxyCzr/iFaXdNl3i38R2fQCThQyPCGMqbZShEhbfjLBRYh aLi3dwE5MGC5pSUMVarkVsbYAOAc3NLaQOFoIavPa33UlnZqSYaleUnGn7i9N9ULmaWM +3ABueIH45jL9NI/cbv1RBT9ZWTrwfYRveeCe2IjPG2sfVC8zH6wNbJtPU6ycPzsilxw J4BSHVDq3kjJyoeUIMm/1RhwrJRDvmrfTNMCHeTRl96bHG+dtzY07kShW5VC1XSWryr8 yLAjUwXVoaEU81XGCaw9s31GT3e/2GuZKJAtUpjIsVEzLnj8hSzp3gbQ4MqspCzPnRGM lPiw== X-Forwarded-Encrypted: i=1; AJvYcCX2/OLvzsmptVcZSRTrroC/kniujx/q3/4QLVcixZExHYYxTrI+9/E40Zs3Si7KuWCxskG4P/RPfokLVAg=@vger.kernel.org X-Gm-Message-State: AOJu0YwCzk9GrxQamSpPujDEjHV61ctFK1vWYwxwb6R8DCkOVuM9gho/ lvHQnIYIkz870C6Nurhmd3EplZ2rq42TdURO9AZXHfWCcC7t4q/F/SMHTfb4Upn1kuU= X-Gm-Gg: ATEYQzzbtvmTa95txE0HuK95z5TXQRgxqPFaPpelzC85GRWJt2ydWgu8bS2+Z7JiU8V ImJ2RHVkMwj+zTxzYM7EbxRVJMTi2xG65uxKVvWaYefE8kRernmVb2K4GoeHpQj0XuO98XKMVpE 2qEdSWeOC20Pi8EsrmbkXdvLgrg39mTfi9JZRi/yWL5TeFz9f1Yx+qSR/pemgD+4OjeoXW6/LAi y5LMYeS8C5+uWuc/+UNSx3wK0TCZrZzX5VJ0tk+1ImITtq6szhzTCXyFQIZyhbFau0uOFql0QwT wvCPMfCM0AugdhRdNHKx3Qf2Q/H8VU7OP5cD5HGif5fUCzhX8MEq/SMaDP3k9imL6Ap9sR2Hc7g IJ5UeIMfrxpYZffL2chBC15pUUGkF/A8N3/hm6xzlg8ZOooPNTnXZjGt6JjMMJYZOEsVqG2gBno nry6zUttbkR6MZnnaq0PXVXm9M1mM= X-Received: by 2002:a05:7022:618e:b0:127:35af:1446 with SMTP id a92af1059eb24-128f3e0ea27mr1436102c88.36.1773408235593; Fri, 13 Mar 2026 06:23:55 -0700 (PDT) Received: from fedora ([179.105.152.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-128f6384f6csm1846358c88.9.2026.03.13.06.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 06:23:55 -0700 (PDT) From: Anderson Nascimento To: dhowells@redhat.com Cc: marc.dionne@auristor.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-afs@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Anderson Nascimento Subject: [PATCH 2/2] rxrpc: Fix key reference count leak in rxrpc_alloc_client_call() Date: Fri, 13 Mar 2026 10:23:27 -0300 Message-ID: <20260313132327.409785-3-anderson@allelesecurity.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260313132327.409785-1-anderson@allelesecurity.com> References: <20260313132327.409785-1-anderson@allelesecurity.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When creating a client call in rxrpc_alloc_client_call(), the code obtains a reference to the key. If rxrpc_init_client_call_security() fails (e.g., due to key invalidation), the function returns an error and destroys the call, but fails to release the reference to the key. This leads to a reference count leak, preventing the key from being garbage collected. Before the patch It shows the key reference counter elevated.=20 $ cat /proc/keys | grep afs@54321 1bffe9cd I--Q--i 8053480 4169w 3b010000 1000 1000 rxrpc afs@54321: ka $ After the patch The invalidated key is removed when the code exits $ cat /proc/keys | grep afs@54321 $ Fixes: f3441d4 ("rxrpc: Copy client call parameters into rxrpc_call earlier= ") Signed-off-by: Anderson Nascimento --- net/rxrpc/call_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c index 918f41d97a2f..fbfcc611a2c4 100644 --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c @@ -227,6 +227,7 @@ static struct rxrpc_call *rxrpc_alloc_client_call(struc= t rxrpc_sock *rx, =20 ret =3D rxrpc_init_client_call_security(call); if (ret < 0) { + key_put(call->key); rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, ret); rxrpc_put_call(call, rxrpc_call_put_discard_error); return ERR_PTR(ret); --=20 2.53.0