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 7FD3414D2BD; Fri, 6 Dec 2024 15:17:01 +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=1733498221; cv=none; b=D41XWKX7o69JKlJpFDIkNt2Ki+nBcCJyWh3oZn8a/QXJYIahepThJl3KCQIggtO5Uxi7o8OInPB30rjjVnDaGHXSrFzDzjvR8jJpF5Siob80P8v2CJdDg9lR6IrHsjbCSfbC9hO+lnO3tkspW99vMWjSuZ4osflgKFqLenHZHNI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733498221; c=relaxed/simple; bh=pqEHftV9NTDNcrLG5Ur7zk1qtWlwK7KmxvSOXnr0CYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JeNy96Ft9LFuTtvl3TEE/i4AoWVkdMRP+kNdfgdMombaEIpBimRFu9JVTPVPE+0YqFWjujcc38ExjeE70ARY1Fs6Om3/t+TslumW98pFo1Ow3culu5nWE7aNfZqxscvPJ9DhybchtKvqOoonCvbTbJQ1RB8PHxmJPP89hgbba1o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H08pO1zY; 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="H08pO1zY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3075C4CED1; Fri, 6 Dec 2024 15:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733498221; bh=pqEHftV9NTDNcrLG5Ur7zk1qtWlwK7KmxvSOXnr0CYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H08pO1zYR/Jnk7W25RshTRHDfvt3FCO7c0+/x5++Sabm9aVcUrT1OOqVXDk2kijw1 K5g/Ru2G3XlH4RD62qIO5REhYcWWwQm/IWjIAg5Z5rlK/kOLl1XxNJ6mD/yb2puE0E o4vWTR/h3cTazh/I4Ssk5Fd+YdSJLINSUGj6Y9k0= 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 6.6 489/676] locking/lockdep: Avoid creating new name string literals in lockdep_set_subclass() Date: Fri, 6 Dec 2024 15:35:08 +0100 Message-ID: <20241206143712.461632866@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@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 6.6-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 @@ -230,7 +230,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)