Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753011AbdLUPUb (ORCPT ); Thu, 21 Dec 2017 10:20:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:34932 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbdLUPU2 (ORCPT ); Thu, 21 Dec 2017 10:20:28 -0500 Date: Thu, 21 Dec 2017 16:20:23 +0100 From: Petr Mladek To: Miroslav Benes Cc: jpoimboe@redhat.com, jeyu@kernel.org, jikos@kernel.org, jbaron@akamai.com, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] livepatch: add locking to force and signal functions Message-ID: <20171221152023.ed2lz2hwuczqwz46@pathway.suse.cz> References: <20171221134043.32543-1-mbenes@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171221134043.32543-1-mbenes@suse.cz> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 938 Lines: 23 On Thu 2017-12-21 14:40:43, Miroslav Benes wrote: > klp_send_signals() and klp_force_transition() do not acquire klp_mutex, > because it seemed to be superfluous. A potential race in > klp_send_signals() was harmless and there was nothing in > klp_force_transition() which needed to be synchronized. That changed > with the addition of klp_forced variable during the review process. > > There is a small window now, when klp_complete_transition() does not see > klp_forced set to true while all tasks have been already transitioned to > the target state. module_put() is called and the module can be removed. > > Acquire klp_mutex in sysfs callback to prevent it. Do the same for the > signal sending just to be sure. There is no real downside to that. > > Reported-by: Jason Baron > Signed-off-by: Miroslav Benes Looks good to me. Reviewed-by: Petr Mladek Best Regards, Petr