Received: by 10.192.165.156 with SMTP id m28csp1411901imm; Mon, 16 Apr 2018 21:36:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx49zrSGqePkoPHk/h1OApRtki0hqXmpKR4CZeodwC4nfDrlAi8MqizkeKcrA+TpBUFeEs3m3 X-Received: by 10.98.150.75 with SMTP id c72mr601547pfe.62.1523939783882; Mon, 16 Apr 2018 21:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523939783; cv=none; d=google.com; s=arc-20160816; b=OKnaa4eNrSWxAV0e8gBJ80y1drRgZ554C1acE9T5OQajTooEYY4oQBMVFQt2IdFgjp oBrFxOdWgxGnG2BU1F8uzQBpLUO9dn6BrL6O+vqEzGhYJ0s6VxrcSDLwjfaN6SmT0eFG +Znm0cpX8eKUdGYVw/J5cTrWg9HCoXgYg2iiTx2EdIOsQw0LLNxmpzPHxIWCMIUvOc2j YxFi2fV4M0z/NjZY81LzbNVkJpz9ivB/bAmTEt8tT0tRMJ2UZ1Kb2tm20Ws1lZ4uNz3w GlVaTTbdwHFLjCBK8632XZ8yxZWRt3KcWDtGsRF4Yg6pEdLoyZqeJZFPyDsOqxvo5O5v 1C2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=o7xKLankzkCyuQvdksu4//AWCVrWxniGsn0xfRvNtR0=; b=Y0Yp9UgQfUBjI9UU6RxVmBWklYxCipaxFqOKbiOdhmnkD02JCSQiglFjUnOnJrzPXD euBzTDqENBGcCh6dNzPCz8doakd3F90eSoyOSrdJOuaSIFOGR+m3I0GR9cE91bjoD80S LSIT8DKCZpjKbi8JbjE5StCObg+218115kZo+seW6c2k9LSAUs2MjOtH5XQTLmQ2YrhX /STTHJHCUq2k6+9dTyLuqi9QpflNvKhhd8hb1U/Du+FYqQt1qdchVGbnd/4tphUXANQf FCTmltxvVN6Gg0faJrRRp12wXcIR+3mFFelvvNr3g5LEf2FvhT4E6lNoVWTo78YMMuJC wbQQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11-v6si5599412plo.276.2018.04.16.21.36.10; Mon, 16 Apr 2018 21:36:23 -0700 (PDT) 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbeDQEdn (ORCPT + 99 others); Tue, 17 Apr 2018 00:33:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58078 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752087AbeDQEdl (ORCPT ); Tue, 17 Apr 2018 00:33:41 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3H4WaDb007109 for ; Tue, 17 Apr 2018 00:33:40 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hd4m8kgjv-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 00:33:40 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 05:33:37 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 05:33:30 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3H4XTVa51052636; Tue, 17 Apr 2018 04:33:29 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30DFFAE056; Tue, 17 Apr 2018 05:23:20 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D23EAE051; Tue, 17 Apr 2018 05:23:15 +0100 (BST) Received: from bangoria.in.ibm.com (unknown [9.124.31.151]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Apr 2018 05:23:15 +0100 (BST) From: Ravi Bangoria To: mhiramat@kernel.org, oleg@redhat.com, peterz@infradead.org, srikar@linux.vnet.ibm.com, rostedt@goodmis.org Cc: acme@kernel.org, ananth@linux.vnet.ibm.com, akpm@linux-foundation.org, alexander.shishkin@linux.intel.com, alexis.berlemont@gmail.com, corbet@lwn.net, dan.j.williams@intel.com, jolsa@redhat.com, kan.liang@intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, tglx@linutronix.de, yao.jin@linux.intel.com, fengguang.wu@intel.com, jglisse@redhat.com, Ravi Bangoria Subject: [PATCH v3 3/9] Uprobe: Move mmput() into free_map_info() Date: Tue, 17 Apr 2018 10:02:38 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180417043244.7501-1-ravi.bangoria@linux.vnet.ibm.com> References: <20180417043244.7501-1-ravi.bangoria@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041704-0040-0000-0000-0000042FC5DE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041704-0041-0000-0000-00002633CDDB Message-Id: <20180417043244.7501-4-ravi.bangoria@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-17_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804170041 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleg Nesterov build_map_info() has a side effect like one need to perform mmput() when done with the mm. Add mmput() in free_map_info() so that user does not have to call it explicitly. Signed-off-by: Oleg Nesterov Signed-off-by: Ravi Bangoria --- kernel/events/uprobes.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 535fd39..1d439c7 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -704,6 +704,7 @@ struct map_info { static inline struct map_info *free_map_info(struct map_info *info) { struct map_info *next = info->next; + mmput(info->mm); kfree(info); return next; } @@ -773,8 +774,11 @@ static inline struct map_info *free_map_info(struct map_info *info) goto again; out: - while (prev) - prev = free_map_info(prev); + while (prev) { + info = prev; + prev = prev->next; + kfree(info); + } return curr; } @@ -824,7 +828,6 @@ static inline struct map_info *free_map_info(struct map_info *info) unlock: up_write(&mm->mmap_sem); free: - mmput(mm); info = free_map_info(info); } out: -- 1.8.3.1