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 D9FB0C8F1 for ; Mon, 18 Dec 2023 06:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KMbQgL2l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12322C433C7; Mon, 18 Dec 2023 06:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702882396; bh=fVHeQ3XB4kGVbvG8trcdzhlOFXJCIm6geR4rTO2sLwY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KMbQgL2l2gO7u+z9sLtANaxVKrdt7WWhJzTo33ErQwZM0trRZnj8Eu8P6UkReAvUR cEbMcYaBqCELd14ibErazf3lEoxHWLYOgERZMu1vWv4XbYu7VSihZBlwQwKABQiE2X LFqWxeAyuZ5MO8J1Fbjn80uyVzXVs9rDEhz7kjvI= Date: Mon, 18 Dec 2023 07:53:13 +0100 From: Greg Kroah-Hartman To: Chunyan Zhang Cc: "Rafael J . Wysocki" , LKML , Jing Xia , Jing Xia , Xuewen Yan , Ke Wang , Chunyan Zhang Subject: Re: [PATCH] class: fix use-after-free in class_register() Message-ID: <2023121858-slider-trustful-44a4@gregkh> References: <20231218024403.1076134-1-chunyan.zhang@unisoc.com> <2023121830-proxy-washed-ae4d@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2023121830-proxy-washed-ae4d@gregkh> On Mon, Dec 18, 2023 at 07:52:18AM +0100, Greg Kroah-Hartman wrote: > On Mon, Dec 18, 2023 at 10:44:03AM +0800, Chunyan Zhang wrote: > > From: Jing Xia > > > > The lock_class_key is still registered and can be found in > > lock_keys_hash hlist after subsys_private is freed in error > > handler path.A task who iterate over the lock_keys_hash > > later may cause use-after-free.So fix that up and unregister > > the lock_class_key before kfree(cp). > > What task iterates over all hashes? > > And can you put ' ' after your '.'? > > And how was this found? And more importantly, how was this tested? thanks, greg k-h