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 19F862144C4; Thu, 12 Dec 2024 17:25:18 +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=1734024318; cv=none; b=od2hDcaFy0oeb2Z8NJRgLPIBzIvJi/IivUaT4ApEy6Ul9t+oqveZ33dRror04I+AxsDAbLyNi08FkAN7AbwmzBxZPRQQ0RAlxWWTcDvI0TGvPiKiEQXzHY4rX4L6L6vSrJFCjuxDusxWszRwYybelp1m44g5e7drury+DU3g2O0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734024318; c=relaxed/simple; bh=NQQxk9ARyrFvjyVL4TBjI7rrc0IQgu5unzgLrgInSe8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tR5+uqv4wScyFQhyts8593TLYDe0ECPn4kMcrNkGocbG/nJwEWlNlLtfBUFuQfeTDCdKQ+SlI9JdEPk8TxlW2wMloHFgOnyGx0O+uBCuL9sKVqNthSaF3XX7xLrj2EwsRZzqPVzVYip3KztMKQPo86/zGUwHhaj7FSTSOrKPpis= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SMFFuoIc; 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="SMFFuoIc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C16AC4CECE; Thu, 12 Dec 2024 17:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734024318; bh=NQQxk9ARyrFvjyVL4TBjI7rrc0IQgu5unzgLrgInSe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SMFFuoIcwucO3S/viBAPUht2O7HmUmLOMXms0xq0CTWOPU7fUtYSoDSRS1E0p8HKA OOlIW7R+n5Fgnsc/tGw8eW/HimCGIvUcjUCR5IYnjdhRMSdhIIpI/AFxcHbV4VJEKy ES2ZtgOocNzHwXx6lvOrZ2ZW13Jc/D+BCCEJ2AAU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+7f4a6f7f7051474e40ad@syzkaller.appspotmail.com, Ahmed Ehab , Boqun Feng Subject: [PATCH 5.10 257/459] locking/lockdep: Avoid creating new name string literals in lockdep_set_subclass() Date: Thu, 12 Dec 2024 15:59:55 +0100 Message-ID: <20241212144303.751132906@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144253.511169641@linuxfoundation.org> References: <20241212144253.511169641@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ahmed Ehab commit d7fe143cb115076fed0126ad8cf5ba6c3e575e43 upstream. Syzbot reports a problem that a warning will be triggered while searching a lock class in look_up_lock_class(). The cause of the issue is that a new name is created and used by lockdep_set_subclass() instead of using the existing one. This results in a lock instance has a different name pointer than previous registered one stored in lock class, and WARN_ONCE() is triggered because of that in look_up_lock_class(). To fix this, change lockdep_set_subclass() to use the existing name instead of a new one. Hence, no new name will be created by lockdep_set_subclass(). Hence, the warning is avoided. [boqun: Reword the commit log to state the correct issue] Reported-by: Fixes: de8f5e4f2dc1f ("lockdep: Introduce wait-type checks") Cc: stable@vger.kernel.org Signed-off-by: Ahmed Ehab Signed-off-by: Boqun Feng Link: https://lore.kernel.org/lkml/20240824221031.7751-1-bottaawesome633@gmail.com/ Signed-off-by: Greg Kroah-Hartman --- include/linux/lockdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -233,7 +233,7 @@ static inline void lockdep_init_map(stru (lock)->dep_map.lock_type) #define lockdep_set_subclass(lock, sub) \ - lockdep_init_map_type(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ + lockdep_init_map_type(&(lock)->dep_map, (lock)->dep_map.name, (lock)->dep_map.key, sub,\ (lock)->dep_map.wait_type_inner, \ (lock)->dep_map.wait_type_outer, \ (lock)->dep_map.lock_type)