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=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 9CD55C63777 for ; Wed, 18 Nov 2020 13:38:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A33A2468F for ; Wed, 18 Nov 2020 13:38:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="mA5Q8hyR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726483AbgKRNiA (ORCPT ); Wed, 18 Nov 2020 08:38:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:53348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725613AbgKRNh7 (ORCPT ); Wed, 18 Nov 2020 08:37:59 -0500 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 B01C72083E; Wed, 18 Nov 2020 13:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605706678; bh=P+lKd6Cp9dTnNzATmRAOmmnRc5Z7Qf95WiE+ievVsdc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mA5Q8hyRZabo4Ckslku4EqVouauRpY9MJQdsioWwhWscLcHOH0EoDGIElTN+Ido9Q jdBbn9i03BnpQnVQEcLLT7yLEpNIsf9uTDPaasO8FvUwNFCyvflYHIjbIKoS32EZFy Fc/ShGGS6+hqKlqDEef/j/ukZ9MxZvze4eI1Ua/Q= Date: Wed, 18 Nov 2020 22:37:55 +0900 From: Masami Hiramatsu To: Alexei Starovoitov Cc: Luo Meng , Josef Bacik , Alexei Starovoitov , LKML , stable@kernel.vger.org Subject: Re: [PATCH] fail_function: remove a redundant mutex unlock Message-Id: <20201118223755.b8e4f8e8f72a251d670a8a2e@kernel.org> In-Reply-To: References: <20201110084245.3067324-1-luomeng12@huawei.com> <20201111183129.3c58ca0c381e30d05b1392c8@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, 17 Nov 2020 20:08:08 -0800 Alexei Starovoitov wrote: > On Wed, Nov 11, 2020 at 1:31 AM Masami Hiramatsu wrote: > > > > Hi Luo, > > > > On Tue, 10 Nov 2020 16:42:45 +0800 > > Luo Meng wrote: > > > > > Fix a mutex_unlock() issue where before copy_from_user() is > > > not called mutex_locked. > > > > Oops, thank you for the fix. > > > > Acked-by: Masami Hiramatsu > > Did anyone pick this up? > If not, please resend cc-ing bpf@vger so it can get into patchwork and > be processed by bpf maintainers. OK, I'll resend this to the bpf@vger. Thank you, > > Thanks! > > > > > > > Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework") > > > Reported-by: Hulk Robot > > > Signed-off-by: Luo Meng > > > --- > > > 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 63b349168da7..b0b1ad93fa95 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.25.4 > > > > > > > > > -- > > Masami Hiramatsu -- Masami Hiramatsu