Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1236629pxu; Mon, 23 Nov 2020 15:33:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/THcEnaglCCl8i5+RCPtfknupXqMkCM9W0JBTAxxkRSW8RA+j89OXNolXPeZo3+A3+NQg X-Received: by 2002:a17:906:13d2:: with SMTP id g18mr1852455ejc.76.1606174432694; Mon, 23 Nov 2020 15:33:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174432; cv=none; d=google.com; s=arc-20160816; b=VF/DkbnHuoNoJ8MW4zYX6/vZVkdzyVDLi+owfmhMCXDHDXWwBHWXhVcFzYsbotCSa8 AuGnA7VFniT1zKMtvcV9t2qu+aC9kbXqEu3R/8W6LjlkAoBo0jtVMd+0oVJ2Ves01cK0 HRaZQk6tA3MvkWAyE6l/+BB0nVUVV8dSqW0fhTN/Sv5LgB4VPizxNF84yiXRUwwON0yQ 18nanXBCaeRj/BpIK3Hu95yWanKpSRMS0w4kV/zDtm8CSKs2l/CbM06Z/0rGaOB1DSsc nTUC3zqFBQpVOwMdRvE7o0mfkZIl6Rd4thKs16jvku+f6jT0wMxEvRITHoVlapg54zRN 9ykA== 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=+CKXnkHohFZjPG1HwdmHz/rRkQ9Mv+gyupHU96L5HMk=; b=eXeGyxOz8FMHOFeOYJasz9M5fIf8skLmALa6XtR0iwrg3kTM/HMLa50YezagIuGqZX XZ63awgmBhdmKpnIacv7wJC6cTecOkm6VBUCse2gYGuuPCpJzGojFGs2tftttF5bPDpw MG6BMlfW0cvlH7B9mJdt19UyYwSbI1T/eMD2F1qClYLmL/DnsC0NEyPStbMYGEYSzgck OWhz99i5E3Q6CnaHPvQz9ZjPS1ZnbDRD/21S2t3LdZLxVURX3WrlOYdA/xhGlw64uO3T eQZq3CZwBKtbNfZorW5OpuzAQviJ6OadLkaHMRNRXA9MbtxHd0Im6i9psJ8nrSIrWkOt ETOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q6ebDEGK; 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 g24si7558970edj.168.2020.11.23.15.33.30; Mon, 23 Nov 2020 15:33:52 -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=Q6ebDEGK; 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 S1731099AbgKWMcd (ORCPT + 99 others); Mon, 23 Nov 2020 07:32:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:43298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731032AbgKWMcM (ORCPT ); Mon, 23 Nov 2020 07:32:12 -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 DEE2E20728; Mon, 23 Nov 2020 12:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134732; bh=Hrlo2lAbbS55pQYUuoVLUfNGdkI2Lf8nN1Ho2P/gnSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6ebDEGKtlmQkrqCsbtJQoOqVtsNaTGDPFGRS+TXaiiRqtQtgEBwEY5DMiSsMCrCb evhMNFEMz7njwhRtXJavcI5oLw3GWwYhWxPheUrn9017zlFwac2LJqC5mFPjLmhEX9 KO8p2BmdUtP2UlIcQQQfLosS20Q3sPj0w6V3aKg0= 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 4.19 62/91] fail_function: Remove a redundant mutex unlock Date: Mon, 23 Nov 2020 13:22:22 +0100 Message-Id: <20201123121812.334090693@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 bc80a4e268c0b..a52151a2291fb 100644 --- a/kernel/fail_function.c +++ b/kernel/fail_function.c @@ -261,7 +261,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); @@ -315,8 +315,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