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 4CE7C241C8C; Sat, 30 May 2026 18:38:37 +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=1780166318; cv=none; b=aHdRend9Leg04W4GEsGLfm3vU/WGEYZ8N8UIhTxRBbB76azezvBfvDYgCCccwhG3nCA8vPhG9AkHDu3lOKQQPzkR60tkosYqq9gt//x9nbkiikw/zTcgmmkXEb93hpmnv1FQqk5jw+f2qgnz72MsAWSzV6tluVqSCdYEI1jXFqQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166318; c=relaxed/simple; bh=9iKQjByz+4Hrv7W9ozeceCMRTDMZSYZdRKY38O+g6q0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=urLo7zX2c7FOvxqbpklCR7Ce0+cH7Nu/Re2d6lBBr3heRL1PbguGWGFWD09kyoNOtCpIHwUsk+1HGwv1r3YfsxX/09V6L1UnY7F8P99XNDEV6SwugebFAmm9ri4gyu3XaM1i89b5iG04wsE305aC25SPVkUQ49AoDVt4t2sGix8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gThe1FWc; 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="gThe1FWc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9337D1F00893; Sat, 30 May 2026 18:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780166317; bh=L4Obwb9iUakeLGDX4kY+FXr08aFld7zx1gEcmMxd3gU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gThe1FWcOGsJIqTnnpuRqVamikCh5OWTI4cHmJgdq5W2sxF0Pk2ZOzqtAb8CCp4+G g2fTq1aE9Y8/MzZDWMVvsPu2DHZYC8MyH2dN8C8rzT1BNfQIDAFUEC8VpIrbGyF16U wzq9r5pSlNOMlZNDL5FVvhiuYJecFTz5gRPprcVs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sander Vanheule , Mark Brown , Sasha Levin Subject: [PATCH 5.10 320/589] ASoC: sti: Return errors from regmap_field_alloc() Date: Sat, 30 May 2026 18:03:21 +0200 Message-ID: <20260530160233.342830356@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sander Vanheule [ Upstream commit 272aabef50bc3fe58edd26de000f4cdd41bdbe60 ] When regmap_field_alloc() fails, it can return an error. Specifically, it will return PTR_ERR(-ENOMEM) when the allocation returns a NULL pointer. The code then uses these allocations with a simple NULL check: if (player->clk_sel) { // May dereference invalid pointer (-ENOMEM) err = regmap_field_write(player->clk_sel, ...); } Ensure initialization fails by forwarding the errors from regmap_field_alloc(), thus avoiding the use of the invalid pointers. Fixes: 76c2145ded6b ("ASoC: sti: Add CPU DAI driver for playback") Signed-off-by: Sander Vanheule Link: https://patch.msgid.link/20260220152634.480766-2-sander@svanheule.net Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sti/uniperif_player.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c index dd9013c476649..e5c4e5245b255 100644 --- a/sound/soc/sti/uniperif_player.c +++ b/sound/soc/sti/uniperif_player.c @@ -1029,7 +1029,12 @@ static int uni_player_parse_dt_audio_glue(struct platform_device *pdev, } player->clk_sel = regmap_field_alloc(regmap, regfield[0]); + if (IS_ERR(player->clk_sel)) + return PTR_ERR(player->clk_sel); + player->valid_sel = regmap_field_alloc(regmap, regfield[1]); + if (IS_ERR(player->valid_sel)) + return PTR_ERR(player->valid_sel); return 0; } -- 2.53.0