From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60789C2BD09 for ; Wed, 4 Dec 2019 18:19:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AAA120833 for ; Wed, 4 Dec 2019 18:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575483567; bh=TwRb2Jo2UO6eKV3XNXiuSSacNPsSiJZvcfN6vNluiqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0PqBxh5r5UM8H94mj6ZrXvCr8Ts30UG8XKPioQQp7fohxKBiz16YY4qIU19y6KNtu EvOFhxandJvmDFSbvRwaUaViWeBzEh0uijKJddSIbtPXqo9AYaLt0OVORRplbq1FAY sXTa9u6U+j8TFrjEtY8+vBtxJDNYSQ0ldtaAJHBM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730382AbfLDSJl (ORCPT ); Wed, 4 Dec 2019 13:09:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:35686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730809AbfLDSJk (ORCPT ); Wed, 4 Dec 2019 13:09:40 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB03C20862; Wed, 4 Dec 2019 18:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482980; bh=TwRb2Jo2UO6eKV3XNXiuSSacNPsSiJZvcfN6vNluiqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0N/3HbaqIReTq/o+KFh9F164+Ah489n5yGckI5EAMhVLdOspaWXjko/CRURtCl+dQ zLd6RbruESwXZKe1XJimVC8iWpHOxAmW9ev3qX98/SjpZtqNCZO2FPym+pT6uXRGm8 xukQP+YMqiV4maFHHzyxk6xqQIptgfnuxwQf2Zxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "Peter Zijlstra (Intel)" Subject: [PATCH 4.14 191/209] futex: Set task::futex_state to DEAD right after handling futex exit Date: Wed, 4 Dec 2019 18:56:43 +0100 Message-Id: <20191204175336.636498362@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Thomas Gleixner commit f24f22435dcc11389acc87e5586239c1819d217c upstream. Setting task::futex_state in do_exit() is rather arbitrarily placed for no reason. Move it into the futex code. Note, this is only done for the exit cleanup as the exec cleanup cannot set the state to FUTEX_STATE_DEAD because the task struct is still in active use. Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Acked-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20191106224556.439511191@linutronix.de Signed-off-by: Greg Kroah-Hartman --- kernel/exit.c | 1 - kernel/futex.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) --- a/kernel/exit.c +++ b/kernel/exit.c @@ -893,7 +893,6 @@ void __noreturn do_exit(long code) * Make sure we are holding no locks: */ debug_check_no_locks_held(); - futex_exit_done(tsk); if (tsk->io_context) exit_io_context(tsk); --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3705,6 +3705,7 @@ void futex_exec_release(struct task_stru void futex_exit_release(struct task_struct *tsk) { futex_exec_release(tsk); + futex_exit_done(tsk); } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,