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 6D3EA17A2FC; Wed, 20 May 2026 18:32:47 +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=1779301968; cv=none; b=rX0i02O1Nv0PqRVTyio3+1wq8k+0qRmjxhQGtWhifzOprPCvyPc4B3gDO8jiknw6BCWGzrbhRZpoTFJAqaeVv1VFD0jcts/QvmZE5oO6eyd7gu0seR5Q5GonIrKtCKTqOgCXfbw8g6Ei5NMTqOFtKm1HEEoG2595DAtYekPZx1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301968; c=relaxed/simple; bh=t7KDHhuwB4fJTtx8eTGUuGTmvnyJdnaU9oJlHaeQh5s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDxSgbNQz2m/XwH8myUBgehCgTKPXrwlkN41ENqNDx3/hsJJVZBfqceew76p/PmselwujqlBbdsRq09/iDhtZr63TROKRd/dD0SrO3uLQsfEVJV0Mhsx4kJdr5qOkBrFLmsyUdDfZWsWQWKdIf13ewIeFb+otUDdwuDobDaLXmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LUXBM7gl; 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="LUXBM7gl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71CDC1F00894; Wed, 20 May 2026 18:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779301966; bh=ami2pFcE1RJjy9mcOz1xlGVJcBHg0vhm38w+AKEHTV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LUXBM7glV1TFN+dzSFilqyO+CNaP1/nZPGBWWY7SMcGdyYV+mZ4CNIqPu8bW7gGzX o5lPxbog+pIPoAvG2PcewB3pI15qkCqwi4doMiItZqLeXcOFvtx1S0sdXamQ2v4XsB U8Kh8dUO1cGwhSzYgW+F70EHYTPGZngio94qD1cY= 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 6.6 089/508] ASoC: sti: Return errors from regmap_field_alloc() Date: Wed, 20 May 2026 18:18:32 +0200 Message-ID: <20260520162100.543342042@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@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.6-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 6d1ce030963c6..f1b7e76f97b58 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