Received: by 10.213.65.68 with SMTP id h4csp469896imn; Wed, 4 Apr 2018 01:32:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx49L75RdrwQhs1nEhMU/Db1Pxbt+z0crGhkXvttdf6/mDDhcS/PG8YyZDtiOSIhqm2ipR5MP X-Received: by 2002:a17:902:107:: with SMTP id 7-v6mr17534901plb.374.1522830729826; Wed, 04 Apr 2018 01:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522830729; cv=none; d=google.com; s=arc-20160816; b=tBoM/tYPCc+i0ERoOsNzodXdnBrdALuazYD6fkPY9FGDQ8Y7I4kN2Q/GqnQKKw8j20 z4L2vfYKD2N29emsS34AcCQOf5IA92U7QpZ9DG2eGeWGOUlJ9sojVmSANRm7yrst+L2+ Gvpqiq6DQ61X35B4MHOub2p7ICAck+11TbDZ61xJPgE2Cc+nQULKgrpuYVIU98lAD41b ZVyx7Jzl1T5z6Nkiemz+Fs8KFx4SMPOJgARhuZQpCr753pqL7AIgykQQJjaqkateMqUe dXmU1YTHIfk1fJdloxFDkLxGFwjWhubJxvlU0yN5Iga3XCUV957MgSwqXYBIs/nsK7cD hj2Q== 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=Gv0J8z5vyvr5eJx7xB/oxXBpbUH+zfTPDRyBKAe9TC4=; b=JS7J/ifHjjzfvxpxV4bhJqC4JleeCdFiyK/dQK/pLBuja7X/F2QRUFEOfMDL4UrvzX kE5thinqN0176p4P9C88qno/yg9AeAmS5/iYw8O0+8tpB7UERwpHZHKisX4m3VfMAVxm mK9X4pwFVM4265gTaD+7ueDxm/r6RRJRCwyyW3651Ry0UrzfnQwAgz27IgIS0Up92NiR q0KxtzLH3A63H93pDZON25cXD0RsJfB3W/v13RUm7004I8ej9B+79uGkm4ujzJ9bdlNC 6wN6fSy0o63RsGiDdXlFmO1U2vyjVoe6rr+r3daeFBTT5hF3O76PXuEQQpEGyYXmmx8p psgw== 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 q7si3356344pgn.372.2018.04.04.01.31.55; Wed, 04 Apr 2018 01:32:09 -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 S1751461AbeDDI3F (ORCPT + 99 others); Wed, 4 Apr 2018 04:29:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34096 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751314AbeDDI3E (ORCPT ); Wed, 4 Apr 2018 04:29:04 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w348OqEB012177 for ; Wed, 4 Apr 2018 04:29:03 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h4pjvbk2p-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 04 Apr 2018 04:29:03 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Apr 2018 09:28:59 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Apr 2018 09:28:51 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w348SoCD11993380; Wed, 4 Apr 2018 08:28:50 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEE7A11C052; Wed, 4 Apr 2018 09:21:05 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2267311C04A; Wed, 4 Apr 2018 09:21:01 +0100 (BST) Received: from bangoria.in.ibm.com (unknown [9.124.31.24]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Apr 2018 09:21:00 +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 v2 3/9] Uprobe: Move mmput() into free_map_info() Date: Wed, 4 Apr 2018 14:01:04 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180404083110.18647-1-ravi.bangoria@linux.vnet.ibm.com> References: <20180404083110.18647-1-ravi.bangoria@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040408-0044-0000-0000-00000543446D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040408-0045-0000-0000-0000288359E4 Message-Id: <20180404083110.18647-4-ravi.bangoria@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-04_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-1804040089 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