Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0DC2630F815 for ; Mon, 12 Jan 2026 10:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768214510; cv=none; b=A0xEUqt8PNProXLUk+X7ufg7fzxB8HaM9Ofqlo4YjL/VpunBqkSTUI+BcGDj374O6eeLKavbYkhBiqlteHNnV6QjrdE6w2BoRhrF/RFCa41cvC1+W0p2Ps8pcEqmubOv81GUIJVGFuNCxZiMnXdW8nSCkCh+zkjceEjNY+T1PWQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768214510; c=relaxed/simple; bh=KyWix8r85dy8LRvu/2OxfXUK+uccKCgiy7+bAmKcnMc=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=iastEQYX67/xUIzPQ5a5yNQVW8TsHoquhFjd0WFfSvhiyw8uANrhFq5anQaCjzk1wgGvXs8iiszbYNymXygWpz20VGmuTLm3wEwbx1HUDH2mKOPYmFwYh+TwD79CvF9OIu2aUvphsxzYLqPf4+J24+umQ+FV+qS0gyrEVyZ4htE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UPS3hmcK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UPS3hmcK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C809C16AAE; Mon, 12 Jan 2026 10:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768214509; bh=KyWix8r85dy8LRvu/2OxfXUK+uccKCgiy7+bAmKcnMc=; h=Subject:To:Cc:From:Date:From; b=UPS3hmcKzITxoymAQBCF2HRK7UCvuYzlxas0sC0g61heP4y9mcHInDH+79U+zk9Tc lhYm3G0Ro8/pzkBIaohNiTs0e3sWc0Zg6xiY8p7i+hpsu85WYQtilNVxJnitTXH09R t/NLdaT5VXUI2nJ4INb/wGeX+mv5mHqZMvo5R0b4= Subject: FAILED: patch "[PATCH] ALSA: ac97: fix a double free in" failed to apply to 6.1-stable tree To: lihaoxiang@isrc.iscas.ac.cn,tiwai@suse.de Cc: From: Date: Mon, 12 Jan 2026 11:41:39 +0100 Message-ID: <2026011239-rockband-chewable-857b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 830988b6cf197e6dcffdfe2008c5738e6c6c3c0f # git commit -s git send-email --to '' --in-reply-to '2026011239-rockband-chewable-857b@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 830988b6cf197e6dcffdfe2008c5738e6c6c3c0f Mon Sep 17 00:00:00 2001 From: Haoxiang Li Date: Sat, 20 Dec 2025 00:28:45 +0800 Subject: [PATCH] ALSA: ac97: fix a double free in snd_ac97_controller_register() If ac97_add_adapter() fails, put_device() is the correct way to drop the device reference. kfree() is not required. Add kfree() if idr_alloc() fails and in ac97_adapter_release() to do the cleanup. Found by code review. Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li Link: https://patch.msgid.link/20251219162845.657525-1-lihaoxiang@isrc.iscas.ac.cn Signed-off-by: Takashi Iwai diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c index f4254703d29f..bb9b795e0226 100644 --- a/sound/ac97/bus.c +++ b/sound/ac97/bus.c @@ -298,6 +298,7 @@ static void ac97_adapter_release(struct device *dev) idr_remove(&ac97_adapter_idr, ac97_ctrl->nr); dev_dbg(&ac97_ctrl->adap, "adapter unregistered by %s\n", dev_name(ac97_ctrl->parent)); + kfree(ac97_ctrl); } static const struct device_type ac97_adapter_type = { @@ -319,7 +320,9 @@ static int ac97_add_adapter(struct ac97_controller *ac97_ctrl) ret = device_register(&ac97_ctrl->adap); if (ret) put_device(&ac97_ctrl->adap); - } + } else + kfree(ac97_ctrl); + if (!ret) { list_add(&ac97_ctrl->controllers, &ac97_controllers); dev_dbg(&ac97_ctrl->adap, "adapter registered by %s\n", @@ -361,14 +364,11 @@ struct ac97_controller *snd_ac97_controller_register( ret = ac97_add_adapter(ac97_ctrl); if (ret) - goto err; + return ERR_PTR(ret); ac97_bus_reset(ac97_ctrl); ac97_bus_scan(ac97_ctrl); return ac97_ctrl; -err: - kfree(ac97_ctrl); - return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(snd_ac97_controller_register);