From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DAF034B1A6; Tue, 21 Jul 2026 21:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670361; cv=none; b=dYiVt/vy9HD6e+/+4M9sJMMOxJ1/LeukqT0D+W0iM4HGcpSpdM8sVaNQOFJVUqp3p+d6HKw/+TJtBCo7Dkl/jTPWsRgx2/xu1x3wJ55TR8X8ngPdg7ZYGY9Y96z2sewbNwYKzv35QDdsLQ6jACSbRtLUIv7/0pgBBrt7oBkq+/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670361; c=relaxed/simple; bh=U6C9K+XaYnw6xwfIlj7hcD5Ddm5+1/f7bgjdfRgM/40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VOKKhWIEx6jxbCT69TGwrvdyUsufdzbCDP4QZgpNglZmRMxdL8SL7Zvp8IU9YN70PR7IsEfaVueYzyKR7h+/u2vRoXZMCrsdDwSQD7UprpJSSY9ifszUM6PZMVjqiT31RXQEyJgufChL6QlqtQ7eilV0qsFg9FQYSRdUeKlmdb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XSigTOHN; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XSigTOHN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 661B41F000E9; Tue, 21 Jul 2026 21:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670359; bh=/blUEhdHHqVdbYXLISVIyhsle+rRfiENuXLbZBeelyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XSigTOHNyRohFXT5Is079q+xQ3Y7HLputUU1Y2T7ewMFGmsigX5EvPHyw8gWdOMiJ Nb5YDEHa9nl2RSgGOtSKhbC8Z3srmXbbgQD+rh+Z3OEgkHjXvvn+Bs24a4FCE/FUlR VOnabZDaH+dleKEP19bFLbIievRObLVxHeFAlPUo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shitalkumar Gandhi , Miquel Raynal , Stefan Schmidt Subject: [PATCH 6.1 0886/1067] ieee802154: ca8210: fix cas_ctl leak on spi_async failure Date: Tue, 21 Jul 2026 17:24:47 +0200 Message-ID: <20260721152444.350803244@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shitalkumar Gandhi commit e09390e439bd7cca30dd10893b1f64802961667a upstream. ca8210_spi_transfer() allocates cas_ctl with kzalloc_obj(GFP_ATOMIC) and relies entirely on the SPI completion callback ca8210_spi_transfer_complete() to free it. The spi_async() API only invokes the completion callback on successful submission. On failure it returns a negative error code without ever queuing the callback, which leaves cas_ctl and its embedded spi_message and spi_transfer orphaned. Every kfree(cas_ctl) in the driver is inside the completion callback, so there is no other reclamation path. ca8210_spi_transfer() is called from ca8210_spi_exchange(), the interrupt handler ca8210_interrupt_handler(), and from the retry path inside the completion callback itself. The exchange and interrupt handler paths loop on -EBUSY, so under sustained SPI bus contention every retry iteration leaks a fresh cas_ctl (~600 bytes per occurrence). Fix it by freeing cas_ctl on the spi_async() error path. While here, correct the misleading error string: the function calls spi_async(), not spi_sync(). Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") Cc: stable@vger.kernel.org Signed-off-by: Shitalkumar Gandhi Reviewed-by: Miquel Raynal Link: https://lore.kernel.org/20260421073259.2259783-1-shitalkumar.gandhi@cambiumnetworks.com Signed-off-by: Stefan Schmidt Signed-off-by: Greg Kroah-Hartman --- drivers/net/ieee802154/ca8210.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -921,9 +921,10 @@ static int ca8210_spi_transfer( if (status < 0) { dev_crit( &spi->dev, - "status %d from spi_sync in write\n", + "status %d from spi_async in write\n", status ); + kfree(cas_ctl); } return status;