Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp79073imu; Wed, 2 Jan 2019 02:42:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN43VtjCijHaKv896SM9S6NlH0F5cneyR7g+AnoVscYXfXq61iIl02DsluCL1bAr40aA/gka X-Received: by 2002:a63:4342:: with SMTP id q63mr13071127pga.63.1546425740552; Wed, 02 Jan 2019 02:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546425740; cv=none; d=google.com; s=arc-20160816; b=h7Ws+Zts+UkinAaV9YE/YiOT1jXLVJTYFOWLJsJgNnQnfnrXlVBfYV/WB5F9BkgVGh aLUDSLEH9WqyQt6572w/Q8W/Fr0xYAIRn+NtCS+1VpqF2U6J+C+KfkQLcZRcjLy8BUcI 7aghcikaIRt9KPY1fhSBvgBXHWgG1yLPEVyvyaxe3j5k/OxQyI0gr1V0VMQe37WEI62g bkrwChkfQFI46ZnzRyQPiKHom3rtKAKqeJKh9ZCSUCIvaMe+/+ZSSH9qXFuTHaed5fe+ RBmVz2mM53uJft9a4ktAMSXr5ng5I0ue8ueoAgST0v5uQP3HORUjoDaKAidq0zI14oFi mAKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization; bh=oeN4+OcZw9iS792FfLISrDhsnUQYETVTUtUkqiehUPg=; b=PBW3neTmqTEtIxvQqmn72TrtFPen+CmQE6IeMstFD+8akm85fPrCKdvRrzkTyxlO8m m46Aozv8u89k5vhq97mV0CGm75DLCfrpGfYaf6E2FGn1nFYwpNmvmrFCZMwx1HlF1D40 hHbbQbFzU7Um9Hnj9hQNdcnB4ds7YBbVn4+43sEImjWEwbgmJlTMoUsdJRp8uN8Ve6pv Vffg6Pzell1tEmXuvpTwOIk71yGMelXdcmjkpQbpo4OF+Rm1uF46XGv388PTKsFOOBmW Msjt0SYnkAjuIga/8AuD3P98Y4c2pwp/q2YJUgh7ba11RvEjMufGyhWjKBiwbMS1ELJr dvAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s59si35225216plb.350.2019.01.02.02.42.05; Wed, 02 Jan 2019 02:42:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728878AbfABJe4 (ORCPT + 99 others); Wed, 2 Jan 2019 04:34:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35000 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbfABJez (ORCPT ); Wed, 2 Jan 2019 04:34:55 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7376DC059B8C; Wed, 2 Jan 2019 09:34:55 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-244.rdu2.redhat.com [10.10.120.244]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB9E46013B; Wed, 2 Jan 2019 09:34:53 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20181226135618.12784-1-baijiaju1990@gmail.com> References: <20181226135618.12784-1-baijiaju1990@gmail.com> To: Jia-Ju Bai Cc: dhowells@redhat.com, benh@kernel.crashing.org, joel@jms.id.au, eajames@linux.vnet.ibm.com, andrew@aj.id.au, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fsi:fsi-sbefifo: Fix possible concurrency use-after-free bugs in sbefifo_user_release MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26863.1546421693.1@warthog.procyon.org.uk> Date: Wed, 02 Jan 2019 09:34:53 +0000 Message-ID: <26864.1546421693@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 02 Jan 2019 09:34:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jia-Ju Bai wrote: > + mutex_lock(&user->file_lock); > sbefifo_release_command(user); > free_page((unsigned long)user->cmd_page); > + mutex_unlock(&user->file_lock); It shouldn't be necessary to do the free_page() call inside the locked section. David