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 8C96F34A3A7 for ; Fri, 13 Feb 2026 12:12:08 +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=1770984728; cv=none; b=PfmotjX0bYKrMoALUqvMHiafBSvVfmQ3Wi0v/jqBZiFUaSdkUXjGNNCJBpCnfMzTeDrFHL/7EcBdR3CTCkatjUotVYp+QPyVzvfOPZIawBE2fIz4MHOzWF3d8oj6+u+cSYRBK82aqS5mYs06EKX+ldrMeUBRmreaiMDVGcypeIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770984728; c=relaxed/simple; bh=LTDvWJX/gAMGQRNPOlROV51TDy7ULPdzSNbs6wEDpAM=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=QWIooU4W+dgtBtz59TkcraBn3xzV+KQeeeoHUBsRDid5n0VyFeg7QHAHRPrxPUH1aMZBh28lteTU8Lq5S/aC2bhzjGzVovluIibc++p4nG1pFg8JdJKVKPS9OGPfydP+ur2R7VnNJMHOK/K+WnOHXWl9JDfL5T0vVMuqj8hmWkY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N0n6ujCo; 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="N0n6ujCo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A723CC116C6; Fri, 13 Feb 2026 12:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770984728; bh=LTDvWJX/gAMGQRNPOlROV51TDy7ULPdzSNbs6wEDpAM=; h=Subject:To:Cc:From:Date:From; b=N0n6ujCo/7vYFaG37QzMFJ4fhHAOa9Gy3tuwbNsSiMol1x+OGRdOqvHCExNTk3lwu wmRnl3nSnk1UbiHzoyZ7LHxGkGygmEYAJ5lFXpvRWAaumWoKni13/iZSk1kO+hwmOF 6rNMtevNPCSXvq335NuaPbElwVQZXPtDL3SW1rm8= Subject: FAILED: patch "[PATCH] bus: fsl-mc: fix use-after-free in driver_override_show()" failed to apply to 5.10-stable tree To: hanguidong02@gmail.com,chleroy@kernel.org,ioana.ciornei@nxp.com Cc: From: Date: Fri, 13 Feb 2026 13:11:48 +0100 Message-ID: <2026021348-eldest-semantic-7287@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 5.10-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-5.10.y git checkout FETCH_HEAD git cherry-pick -x 148891e95014b5dc5878acefa57f1940c281c431 # git commit -s git send-email --to '' --in-reply-to '2026021348-eldest-semantic-7287@gregkh' --subject-prefix 'PATCH 5.10.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);