From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F0C132D7F8 for ; Thu, 25 Jun 2026 11:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782387636; cv=none; b=JV9K/N+uMs2j5/zBjX7X7G6+X2Pol0UKuE9xEMumwwOk4yoq2J6ZLmZXAYSUb0dG2pJSzRCU1ksrOSKoB6TEbG6dVvz2xqUydMsJDcEdcO5k7KVHWAHoTK6Tp7EPe96FWle8jQfO9aIMnSxnKvo8RCuHqBT0WgFCchPQDY0+Hy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782387636; c=relaxed/simple; bh=6tCcK0Wha+Cu9ljuk6vj8GRDQOG6jGY1bJFI47gFVPM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Kc01rIKDd8llH+DqwpIPqefPjxNdcCVbWKJoHBb072U/4yDib0VXhTgVSbZqhuTefrn2ez4XzPY57H7VGF5zsUiJDiVe6uKqTAW1hWtQXuzQd84uVm/gCuAiP6Re8uQ8wLTj8Yrft+nFWKjwjJveJu7MIJ+d6WPOQ09XTeaniKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=ZC3erGuw; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ZC3erGuw" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-46daae24c79so559679f8f.0 for ; Thu, 25 Jun 2026 04:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782387634; x=1782992434; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=u9THjTZ2usIXsGHXM1rJ25r4icUC+nwPpYCGZUGk0U4=; b=ZC3erGuwsfeC9+JLPs/vJZ3cs2zmcv5680dBvbkvJKxWXjNwMy3iVc1Gt+fIWFmh4R fIqakqF/lNWwnAolmWWkwwuvtVprt187MHMAK6ZwJP7Vpf3QbB2R6+7HmySOEwTX13Kd wCS//G8Hy4Hdj9lTEMm0GAQsZnhPXEVe0I9kWv6gVkPjTjM2vq3/+rqhPV8ZqxgC8stw G3NOyS1uMoD5rkmgZro/ci6irxKJonoTQR7f0EfYHJeka7hYNaKVeyrg6rLvtFd2J8EF jxfN0jtwq9dvBb3dui1E0PUmFQJvmKdo6nl4eTwcqyQyM8oCcnDwZe/4Npf8z2MAo2Uh MitQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782387634; x=1782992434; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u9THjTZ2usIXsGHXM1rJ25r4icUC+nwPpYCGZUGk0U4=; b=kaccLDoCnjySVdQQSgN/6qDw/egkZ6CI2e4TyRA/OVie9nwt6/oaK2Vbc/c197eS4U enwcYLNftcpfduoiEVH8Ee5bzlWOAJSQOt7qHr/2/xpquUGXuRHqWf4bvXc69GiCRsYi nMG45EsXX7N7RtlYu4vXvoRd5IxDMZLb0SjnjPNE1peOqP3Sag+4oDfwYXS7i9OraCQM XRCOI/bM+MnprefNhmkuUOGDsnZURmjG7uB33cA62oD4Mdl5tpWJE982uShKFnznibrt T+cisZ8BdupmvejyrEt/sNY4pAK4BRWE4un9BpTlT9Y/gs8mhy/QlsGNwF7FwnwW29uJ D2Ew== X-Forwarded-Encrypted: i=1; AHgh+Rp6sJGoTFSCmUP+VBx+oO91MQ1K916GUIiSBzSALkAke3AQ00QgfuOCF0t8tBPc0EVU2gS6QM0zec8fGHM=@vger.kernel.org X-Gm-Message-State: AOJu0YwHZE/HusS0Hq27ZvvezE0XBmn3eZZOwX5irDNxIfeVCowsnMxA E71puMW3hgBwKU3WZ3Ih8e5Z7CtyKALay6jrBwPpQoUjgBRlGfSu6qwEd3YcVZ8gBsE= X-Gm-Gg: AfdE7cldu+l66u6y9tvPFykO8cGbIt7wsW55rvHEn8bdItKqT0h2WWiWq61MWSXUAc9 nZ9wJfBeeeX31oKAFroyXVVqp8f969PdCFHD3g0veR0qOeIXWcJpD7DlzN715NdOKIBmeve9Un5 b7KUQ+exZx3Tp2prr9RCwlXvYmehBukSqbpRtJ5eaq2WqI5me3jUgXxlHZT6H1l8myl+0UrAc5x xk7djPegepzyvKRF8/Q606OTfID1lf8JZGSAMA3H/GZjNyzC/gL/6EaILioo7hl9cLn8xGvHZkO FqZ0ApSAqm4iyPWNiF56thJCSL1zzCplsvfIwXUXwYM8nygtGknq7U+uZfhh49LRgDb1t7sUGlO cKp3lVQaqcgdYyb0PYsmsSjPSF22K0f2AgCc0A0qT3uTt2Fzus571EXfuI90xQnyXv+q/4qc0wI dpkGaAtOqUF/mCJtE= X-Received: by 2002:a05:6000:4b09:b0:464:7fc2:d9f0 with SMTP id ffacd0b85a97d-46dbf303465mr3158755f8f.3.1782387633881; Thu, 25 Jun 2026 04:40:33 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46c221d998esm14496626f8f.24.2026.06.25.04.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2026 04:40:33 -0700 (PDT) Date: Thu, 25 Jun 2026 13:40:31 +0200 From: Petr Mladek To: Jia He Cc: "Paul E. McKenney" , Kees Cook , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] lib/tests: test_ratelimit: fix stress test thread lifecycle and leak Message-ID: References: <20260529085855.1810870-1-justin.he@arm.com> 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: <20260529085855.1810870-1-justin.he@arm.com> On Fri 2026-05-29 08:58:55, Jia He wrote: > The stress test's WARN_ON_ONCE(!sktp->tp) check in the child thread is > racy and unnecessary: since kthread_run() wakes the thread before > returning, the child can run before sktp[i].tp has been assigned. > Moreover, sktp->tp is never actually used in the child function, so the > check serves no purpose. Remove it and keep the original kthread_run() > > Also add a common cleanup path for thread creation failures. If creating > one of the later threads fails, stop all threads that were already > started and free the allocated array instead of leaving orphan kthreads > and leaked memory behind. > > Finally, replace the module-static doneflag with kthread_should_stop(). > With the doneflag, child threads may exit before the parent calls > kthread_stop(), so the task lifetime is no longer guaranteed when the > parent later tries to stop them. Using kthread_should_stop() keeps each > child alive until kthread_stop() synchronously terminates it. > > Suggested-by: Petr Mladek > Signed-off-by: Jia He JFYI, the patch has been committed into printk/linux.git, branch for-7.3. Best Regards, Petr PS: I have already sent pull request for 7.2. And this is not serious enough to trigger another one.