Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3393876lkq; Mon, 23 Nov 2020 04:42:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwooO3l9itYKjR326lZ7+BjyV6VujGa8MdhJe8GtGtU+pYSxyuiOl/t7gbW00ohq/4u/ZxW X-Received: by 2002:a17:906:ce41:: with SMTP id se1mr5270327ejb.155.1606135342970; Mon, 23 Nov 2020 04:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606135342; cv=none; d=google.com; s=arc-20160816; b=wpFV5kuQYyOym/H0/CQPdHrjWkp8+enltCxxKmJ5myQcfquSu3VIE8Vm9BDCAq/72Z Ok46/vKT/lIs5KL8nwHrH2sozH8tki3fAaUEr0CBClLKE2N+fZvOAcZwgjpZj76mJvRS 6VNduyjyMRnexU+116cO0we7hXIB0hJuPmNOU+bJt5ASXNkPH4qrMDWY4ZKxK2e0bDiN w8JjUwJ+UBqUTMKzcr3TAvhV4xSpYs1tolsmwp7g7CGG2phfT6hUZlHAziJVn4Bwa/6x WLVsX1auQjriHPRH2u/qPMZDiLXI7nKbTp4it5f4Vqk2SZYKovWQQ0pCbk7c1VDRROEU SVHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aJ6ma9ddiTMAgyigiou/sc/+3tSs00huOwweoIbU3O0=; b=mww7kPJNkHxos2m47T34NMdiaGHNKRxMv96EQHt5aDVtg+DAgmAET+HG9J4kHoHuf5 q+XLmVR3bhj7Y+WRG66x0BDCOMX/8aKe/B53r457CUw5KXbEf/20NcM1IxNOhdfzk/PO RbSWlOvfesUP/5CEn/P0jvi7EdD5zTRfpnJGccKW/cd/YAOsE96tBD1YnAR2iMAFWOBQ wZniaGSq8Kd4/+3xAI2mtoSxJgopi2143/Q9+7nkATQeV3Ae1EpBNu5zD08iZlJ2dSQn /ejeXQBI39Des3+HtmqR+/u/aOTKkR1o9Ik0/FKN3allCngcrdz5oCLLIyNpKG1hCPnj hKFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hg7RSZvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pg11si6203060ejb.92.2020.11.23.04.42.00; Mon, 23 Nov 2020 04:42:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hg7RSZvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732153AbgKWMi5 (ORCPT + 99 others); Mon, 23 Nov 2020 07:38:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732081AbgKWMiU (ORCPT ); Mon, 23 Nov 2020 07:38:20 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 1CDB62065E; Mon, 23 Nov 2020 12:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135100; bh=/lnL4kKUQjvt0DPZxtlw/Bxo0DaHITp042FE3rTo8Js=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hg7RSZvVOaDcf1YSZBTU7uj6ENNH5D0TW64H3H+iqsZ7kBwqZo3E78OPosTlkjbAZ 14vLvD4fKiRvYYtpeghEqYQEdfDu7u/sM7ThPOubfgEQqKwKi46wJkE1qNF804fxfT chL6YyOWfFjC13gQEZhXPCfmQD9sGEfY9dkMHLm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Luo Meng , Masami Hiramatsu , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.4 105/158] fail_function: Remove a redundant mutex unlock Date: Mon, 23 Nov 2020 13:22:13 +0100 Message-Id: <20201123121825.003683165@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luo Meng [ Upstream commit 2801a5da5b25b7af9dd2addd19b2315c02d17b64 ] Fix a mutex_unlock() issue where before copy_from_user() is not called mutex_locked. Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework") Reported-by: Hulk Robot Signed-off-by: Luo Meng Signed-off-by: Masami Hiramatsu Signed-off-by: Alexei Starovoitov Acked-by: Masami Hiramatsu Link: https://lore.kernel.org/bpf/160570737118.263807.8358435412898356284.stgit@devnote2 Signed-off-by: Sasha Levin --- kernel/fail_function.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/fail_function.c b/kernel/fail_function.c index 63b349168da72..b0b1ad93fa957 100644 --- a/kernel/fail_function.c +++ b/kernel/fail_function.c @@ -253,7 +253,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, if (copy_from_user(buf, buffer, count)) { ret = -EFAULT; - goto out; + goto out_free; } buf[count] = '\0'; sym = strstrip(buf); @@ -307,8 +307,9 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, ret = count; } out: - kfree(buf); mutex_unlock(&fei_lock); +out_free: + kfree(buf); return ret; } -- 2.27.0