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 60E1B378838; Fri, 4 Sep 2026 06:02:29 +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=1788501751; cv=none; b=IIGToOejXnVO4w7higJ6riMhBch5wYd4Nh3UEaolIXoFHT1eMGoWCmsrQhcRbN2b6nSeRVCHnVRVO5t+Tmweg686ueRS1AfTJXLqkSMn5kwLcyTuycSWl3rqrI3wyO2ednU7Dcs4U3b/JQVUtgMgjVn2Flb19GxW/Tb18pT92WM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788501751; c=relaxed/simple; bh=tUgERgXA+mzmzs20sW7F8RxQkLIMaDD2Se4lobFQkNI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rCdKMxVH/vjLGo0i3JGIuInSkT13c2tIW59rdY+8225hx9Av4nZXewsWRt0QT8ZNUoWBj/eQpieroK0OMC3QehKAwgbHbDWoDDXqZHi9vSrVS5NeusS9mNmAiB0DmWuo3zBUJHW2JipJhxymP3mvY06cJqwBmmxFHq93ZAyXuCs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wURfkZHr; 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="wURfkZHr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B99721F00A3D; Fri, 4 Sep 2026 06:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788501749; bh=zXUM4tbPNUMioW2YNRzSUdINfk+bxbkjLeRJ+k3Hv40=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wURfkZHrRBPBvYJagW82rDoZ9Nht4XfDb5UHdXCxJBQtuhTBgHaBTdRlwScHOsigW 6Yp4yx/qmp6gP3RkPVawgc+oPITcgezDTAMo05Mi6asc3ksgoL3C68YnbMsV3fxgqP Q7QQPPgGcSdo61usFlK3zh68UW7/Nd/epK5lDNC0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Adrian Hunter , Mukesh Savaliya , Frank Li , Alexandre Belloni Subject: [PATCH 6.18 518/552] i3c: master: Fix potential UAF in i3c_device_uevent() Date: Fri, 4 Sep 2026 07:01:15 +0200 Message-ID: <20260904045802.373188878@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045747.813364717@linuxfoundation.org> References: <20260904045747.813364717@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter commit e5e8dd2e959f470524c16ca444d001c90d6bb3ad upstream. i3c_device_uevent() dereferences i3cdev->desc without holding the bus normal-use lock. Since the descriptor pointer can be replaced concurrently, including when a uevent is generated from sysfs, this can result in dereferencing a stale descriptor and lead to a use-after-free. Use i3c_device_get_info() instead, which protects access to the descriptor with the normal-use lock. Commit 6cf7b65f7029 ("i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock") replaced the accessor with a direct descriptor dereference because i3c_device_get_info() would recursively acquire bus->lock during device registration. This change depends on "i3c: master: Fix recursive locking during device registration", which moves device registration out from under bus->lock and removes the possibility of that deadlock. Without that change, restoring the i3c_device_get_info() call would reintroduce the deadlock. Fixes: 6cf7b65f7029 ("i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock") Cc: stable@vger.kernel.org # requires "i3c: master: Fix recursive locking during device registration" Signed-off-by: Adrian Hunter Acked-by: Mukesh Savaliya Reviewed-by: Frank Li Link: https://patch.msgid.link/20260807145638.168865-7-adrian.hunter@intel.com Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/i3c/master.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -315,8 +315,7 @@ static int i3c_device_uevent(const struc struct i3c_device_info devinfo; u16 manuf, part, ext; - if (i3cdev->desc) - devinfo = i3cdev->desc->info; + i3c_device_get_info(i3cdev, &devinfo); manuf = I3C_PID_MANUF_ID(devinfo.pid); part = I3C_PID_PART_ID(devinfo.pid); ext = I3C_PID_EXTRA_INFO(devinfo.pid);