From mboxrd@z Thu Jan 1 00:00:00 1970 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 6AEB534A3A7 for ; Fri, 13 Feb 2026 12:11:58 +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=1770984718; cv=none; b=SADfhBWodlBtK0GUWjttUzb5Kq+wvqmQ5TmZaaTex73rhDOmcIO6eKZNd2ZgTs/r/3El7LhDRL5yPl+CDG/fnp50/SzS//EN6OHGPA7QSZy8K3qlbgSy/TZU6j4L2eYPu1/VgiLDwAjoK1dsDVSmXFs4JzXkBP82K5wIzxIECCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770984718; c=relaxed/simple; bh=shwCLq1iwZUAKn54sh1Pj66uqLrLMQgtHBHXo4B6dWk=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=fglxgzB8z2HcXTYxorpuyo2XSox8kxNEqdkWFTY/H203ktdps3Nc4Ac7hADk3AYHhAtHn/7p5MFsRJYqS8D5nvVyNHHhwHKlKFVc/YaCl7x1Zi8eI0fOOj88fUsRlIQxmAsyiLV/t0/nQQS35MPSaYyeufX5YBCCP1Z5EVwFVWU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CvQwQPAN; 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="CvQwQPAN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70D48C116C6; Fri, 13 Feb 2026 12:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770984718; bh=shwCLq1iwZUAKn54sh1Pj66uqLrLMQgtHBHXo4B6dWk=; h=Subject:To:Cc:From:Date:From; b=CvQwQPANHvni6awCgvgtkmejSmvdZpjFW4vvS0VldGQ3PwvuxmZtunmfXJXEimeiX Gb7qf+BFfuTPTg5Sg9xIjdJ+khZTpAdF8zMXnOvbwQOEY+T4gxIUFNjYqGk3eRgKzX 2pM5GLPooW5y8zj9ifWiL9Qn0lY1FQF9/+qH7sws= Subject: FAILED: patch "[PATCH] bus: fsl-mc: fix use-after-free in driver_override_show()" failed to apply to 6.6-stable tree To: hanguidong02@gmail.com,chleroy@kernel.org,ioana.ciornei@nxp.com Cc: From: Date: Fri, 13 Feb 2026 13:11:46 +0100 Message-ID: <2026021346-runner-symphony-9463@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.6-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.6.y git checkout FETCH_HEAD git cherry-pick -x 148891e95014b5dc5878acefa57f1940c281c431 # git commit -s git send-email --to '' --in-reply-to '2026021346-runner-symphony-9463@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 148891e95014b5dc5878acefa57f1940c281c431 Mon Sep 17 00:00:00 2001 From: Gui-Dong Han Date: Wed, 3 Dec 2025 01:44:38 +0800 Subject: [PATCH] bus: fsl-mc: fix use-after-free in driver_override_show() The driver_override_show() function reads the driver_override string without holding the device_lock. However, driver_override_store() uses driver_set_override(), which modifies and frees the string while holding the device_lock. This can result in a concurrent use-after-free if the string is freed by the store function while being read by the show function. Fix this by holding the device_lock around the read operation. Fixes: 1f86a00c1159 ("bus/fsl-mc: add support for 'driver_override' in the mc-bus") Cc: stable@vger.kernel.org Signed-off-by: Gui-Dong Han Reviewed-by: Ioana Ciornei Link: https://lore.kernel.org/r/20251202174438.12658-1-hanguidong02@gmail.com Signed-off-by: Christophe Leroy (CS GROUP) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index c08c04047ae2..08b99b0b342f 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -231,8 +231,12 @@ static ssize_t driver_override_show(struct device *dev, struct device_attribute *attr, char *buf) { struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + ssize_t len; - return sysfs_emit(buf, "%s\n", mc_dev->driver_override); + device_lock(dev); + len = sysfs_emit(buf, "%s\n", mc_dev->driver_override); + device_unlock(dev); + return len; } static DEVICE_ATTR_RW(driver_override);