Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759638AbcLVTjp (ORCPT ); Thu, 22 Dec 2016 14:39:45 -0500 Received: from mail-db5eur01on0040.outbound.protection.outlook.com ([104.47.2.40]:13440 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752060AbcLVTjm (ORCPT ); Thu, 22 Dec 2016 14:39:42 -0500 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=mellanox.com; Subject: Re: [PATCH] ib umem: bug: put pid back before return from error path To: Kenneth Lee , , , References: <1482390692-147946-1-git-send-email-liguozhu@hisilicon.com> CC: , , , , , , , , , , , Ilya Lesokhin , Kovalyov Artemy From: Haggai Eran Message-ID: Date: Thu, 22 Dec 2016 13:03:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1482390692-147946-1-git-send-email-liguozhu@hisilicon.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.0.52.254] X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:193.47.165.134;IPV:NLI;CTRY:IL;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39850400002)(39410400002)(39450400003)(39840400002)(39860400002)(2980300002)(438002)(24454002)(377454003)(199003)(189002)(7736002)(65826007)(106466001)(189998001)(50986999)(3846002)(47776003)(6116002)(626004)(23746002)(54356999)(76176999)(4001350100001)(5001770100001)(64126003)(107886002)(65956001)(2906002)(65806001)(8936002)(5660300001)(50466002)(4326007)(2950100002)(4001430100002)(31686004)(39060400001)(77096006)(229853002)(81166006)(81156014)(38730400001)(83506001)(8676002)(33646002)(2201001)(305945005)(86362001)(230700001)(356003)(7416002)(36756003)(31696002)(92566002)(3940600001);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR05MB1900;H:mtlcas13.mtl.com;FPR:;SPF:Pass;PTR:mail13.mellanox.com;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM1FFO11FD043;1:v/UF2kdNJEP0H33OSO/Wp86Y+LvahFA+2AiIcTsVljqJTl5F1mhqok5Bwk+H/UgAUqVDzGVFZnN0ptAl6BEspYKZx/0W8zSiwRP638Brf6kWnSZ1tgDudQR2OTsgseZKUWCthtzhgvrSw571wYj14WSGK+NA5Sy36Gsuno6geDPLfvxfFLbMcDLuKp/c57t1gJIZbdTi5GbsQwKb4TOnihvaABgfHBgZ/hPw2VCk66Am0DX/tj4gBaVzAYDKNQRz6ZPtJ0EkZvaA0tagnFbiOpZRpHA/MLp++PP60eSZqt5bzCVrJ5eNMMvyR8gn5I4DrJ2vDlGDwcxfBEq5QGLHvytd2/RQsARDDvGg4qNDQkAP0MuYLQ5wOt5FC/3f9QyphGlvQNx5xtMudCqbEcpAaX5l0WZ6mtU+Ietmh1X4vd6b026TpvFPXPH28KWVsTFdpDbJhBSM6Sqwdk3p+deF7SDBBTgcu581jJK72WnYTk6tHNYABtB+1QWmED245VI5KuGV6V2kc0/9K0m6fVES/KJwyVN67GJQBmBBGu3R2CikzywwIBNXiP2ULrOcUwUGxkjz66559HqjT+FslojU+y9TZiSA3TaotBXj/h4GDpY6FPDafSMrdczxCsnRs7Ir X-MS-Office365-Filtering-Correlation-Id: 70268672-2122-4fae-d32e-08d42a5a2408 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:HE1PR05MB1900; X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1900;3:Y59pMvDqXLm1VXE6cDH2ALSUh11pADWJiXuGwCWT5hjQvb3YLJX+Q3iviwmVwqa1oi7S1puzeuYvCn7ZInmdrCs6kl+R3K+G2ynk6BYKnP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YnSJ47Gek6H/SoUKnmWbPWUK8v0Rq04ZdXg9SfU4vYzXBTQrIr3stlxbYT4jazV+2DRolCE/AN/xCBvpU= X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1900;31:0SrJw7yMEIpB+PGQmCmaocExAvL113FpkZK8v3OcJbd695UllofN8rzChXiiQ7roKz2uEzWEKbZDgdgiSLqbyBM2QL8A0z6N+DT9qfvXoLa4Q+DSjE9GuS9XF3YPYdnWJ96eBTq9frTqvuFn7dxA7xUGrBoEJXg1DeSJBQkK0GdbAbaJZtGD0aBun+xRQ9SRl9r1sptmKIBfSLvicX+eLUzLD1G2t7sJHws3IcgCSxYu4PNo86iD3PzhtSCtKlIjZPhIsYi2C+hkYocA0XQMcEy1XvA40AykVeXpB1ahErM=;20:EonAEksCLodixzQPqEMJVpMJYvcPzxXhwK0JAd6kOmzRxPMTJNoWQ+8qZxvP5+RFyU3GCU6P9cBzbyJh/1Y/10e67qDYHJhRFJxdHBJ+WAr4wI0+lL+uftqthKsIYel8TQFVi0kV6rPzYUbRzN53p2IJmZ1b6ipFod9eTtlFZhUlAmtxxeLrT1ZiDGDFz6k7eTPuUP2ROiwJqmXzNGfuo5TOUR2f0XmnYS+sgesBTAuEUK+9IjvZru8DZzkdcqiVzr1LjeOGdx3C823+AO4IS2qPN/0pTR27JyIKZm/FaEUqCzWnU0s1opzzACuOmpAyW3CFaX/2Nad87OU6n/XHn8hKzP1MpIO80rFvm5Al4kSCCtYl9/T4YLyPr0YVwDUqTV7ip2+tiYuBZWhZgxGn8Z6gpqpHzPAKq6l7SarFUAwSKe1GXXLNz+w49GIkyl1qZb/MEbX5HlviCPC4tZbzxrWudvQnh9/BJkQGjTgcmIb/CJ+d/nsMrR6pDbFFx1EY X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(6072148);SRVR:HE1PR05MB1900;BCL:0;PCL:0;RULEID:;SRVR:HE1PR05MB1900; X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1900;4:a0DxsePcdk+h34+i0lN6NUaf9X8C0U31vTukd1cuu9kielUfTsczC4i7mERYSdV0dADtSTL1rb+IPWBNvG6zwYXKn5yRgt0f4A8wPSSBv/GMfGiuJ+MvdpD+OMGXsJEYS2FxQGJ4iJYEvRHREN3OhJtXaG8kXIAs999ekq7d/JFsykqwNo67dmKxug+lHLTIolvZzuPpnEjelw8Hu+s32KQyNktDK9cF7j97T0uW+wS7g7A0tVYEkz2kK+u/KxpDYYwynt6vTDClECBMsEiwqPtbepJOu0bAROCMFe2xTEwWcHiWXEf8Yv2RETZdK4FcOX3tm/f3j+godTIgiPXx6/HZoJGwasDzitl9+NdUVzH4ab0UPPANSYWXpXZhkra9U+qq3/d3t2P4I9Tj7LTGJPA/VhPjqQHwtirUgyzLtYoixo0/5l+ZitFbmPZ7g1obMd/vjL0GpDyIkW6XuQwhm3K2Dn09UZJdle8Ajga1Z5VuGDL8umx9xBLg3SNjxxfSl0axiayFH5m6ry5qn+mvwCOC/wOy92VIr8k9z0YmUK9W1/nRVOOabZa1+Ld8jzd9MxDPlBVlEOWjUUbWUizjyQy3pnR3CviBTYH9zq/rAZdtUS/T2aCFpiX4R6SCkL8f X-Forefront-PRVS: 01644DCF4A X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;HE1PR05MB1900;23:H6t9uvmaYSOGpaewc0R9KwiK4QcwfCbgjH5o7?= =?Windows-1252?Q?XgFD3lXTTi+m1eWuTagLPeL0PpV5OJ6kir3WJmOX7kn19/zvhilbmsah?= =?Windows-1252?Q?DxtOcpQoHUItmxvNKkYFHwkmG3kiwO1q7YA3WkGdljIbafExWihs1/HN?= =?Windows-1252?Q?1S3PYRsSZCw/y1L31vmJC2jjKRdSVNqtEpd7Kel2yKslYPkxGsEY/oFu?= =?Windows-1252?Q?qvse0ZiRyBaqENX4qVDEj73PR9w5eiL8VLvJKeappgiwDbc4YJsbrVtd?= =?Windows-1252?Q?Wd9m8rKECovTRy8EchkE9UsYiwqfk+Yak0RmEwG7JSPp+XeaAQG6NY3y?= =?Windows-1252?Q?zPCiMztU/tXBg02kxHxTHp8av+FSgTWtEq6SeYXU7CFBagnTwEqFVZwy?= =?Windows-1252?Q?RrgPjgp7w9pw881GvECufj41ktxPGx45Klhq9Y4v6kR0Lkj2zwKbp/kd?= =?Windows-1252?Q?OaL6VMpJ+zSi6WdxZ7jx9d1r/JRxpPOmerjIsacGRGuHGrEZeI8nzlE9?= =?Windows-1252?Q?Q5LS1b9t733KdkR6c3+oCbVsFySfqg7FFiU89+oB7ubHrNAPYS2DkSWs?= =?Windows-1252?Q?azPFsdTrzdsd6rDS3uCaAllibg6I2ftDOkn8o1vRfvPfpBsidncATF1g?= =?Windows-1252?Q?LFtzZrSuX4sQuy67D5TIcwKQfaqXrJoqk8o576ckKezRZYeGnh0Xau3p?= =?Windows-1252?Q?GadqazCli5nAsMfZIp+lSytKf0iB2edN9aicmmDs/l0bLudpji4n5vgN?= =?Windows-1252?Q?d074td/7rxL4EtV88sKACxtA5hzf5XUZ4CQjxlavH4fl1SR8vqGQgaBt?= =?Windows-1252?Q?5Pk0XSHeZtVsTJFtnn4KH/Oi/3qwROf4bMjHR4+BuaFmapSClS9wiL8U?= =?Windows-1252?Q?iAMz+/vd5Epk8FLaOt9NyabzqcBXTGkVmJWYCWfs5W2V3rq5h5gGlZ2q?= =?Windows-1252?Q?V+L4M/VWIhClpKPNvwzw5s5BCWWfo1KfuvKTL+AKVvRyZqMmGPMkZGwn?= =?Windows-1252?Q?W8o8T1m0qWSKwAZkCZfvnAjyv9LKoeHNM1E/21dF78Nm5/RcMgV+hNGy?= =?Windows-1252?Q?NROuFXvENh07HhYeo+IQgYXv6VqjdGRch1lOXVjbWajiaX4eZ5kQ47hZ?= =?Windows-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HhQvnMLuDEqWr7sgu86H/1151ha2kvEmv1iiBZQv8g+1soeEbmx1cE3cZ6+gqtQyf8OyPnqCmtwbDTQ==;24:2yKw7zPhoSsFdNMH7Lp20fPm8vDZEZw2+bgMi1w1EqI5PSNtMb3NVxELSqezFnPmRAqEoN1YS/ctGHteDT1914YTAlk3GG8SpujnJlJaRLU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1900;7:zsYM1ZSeGWMs0wF9ylZY258FJiKwmLpWGI7fsStQSwAGxjaKW3sy+5EYcUvJdkFN+JmwdU5+6MWrzL+j1JRj4iQblcSqWwSsXwacCHbs1zIErDwi0EVbI5EQ5wVgs0G3f64R8MiKnDjEUfYb4nYCBKqCzNX6K4zHzNMWF3aJcf618tVu4/QhV6pEKh209M00VdX1GrQuYKp+NP9hVMYsrnxBtJNcxqxXH6Yn7WF3azJrTqu+zzBXTySrZv2jdc7qJh7bZRruf9EtzQ4pJ1C2lZYgdC55LPkdP9mBQAjbMkBoeMSdTANM344jiU+uawmBEbzQeQFyLt8vrC8mJ5bxwazt9AyWQG1P/PBBy8tayneJi5w6PqQqspqD40XLgFtLgqz7nPF+GqL1MUcrDNltpIhkoHKN2ApNfMlFWYVB69xAEco8QtqZNjNFPpS+WIXbjrLh3zAVoFrQbvufgleBVA== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2016 11:03:20.4503 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b;Ip=[193.47.165.134];Helo=[mtlcas13.mtl.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1900 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1131 Lines: 34 On 12/22/2016 9:11 AM, Kenneth Lee wrote: > I catched this bug when reading the code. I'm sorry I have no hardware to test > it. But it is abviously a bug. > > Signed-off-by: Kenneth Lee > --- > drivers/infiniband/core/umem.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c > index 1e62a5f..4609b92 100644 > --- a/drivers/infiniband/core/umem.c > +++ b/drivers/infiniband/core/umem.c > @@ -134,6 +134,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, > IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND)); > > if (access & IB_ACCESS_ON_DEMAND) { > + put_pid(umem->pid); > ret = ib_umem_odp_get(context, umem); > if (ret) { > kfree(umem); > @@ -149,6 +150,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, > > page_list = (struct page **) __get_free_page(GFP_KERNEL); > if (!page_list) { > + put_pid(umem->pid); > kfree(umem); > return ERR_PTR(-ENOMEM); > } > Looks good to me. Thanks! Reviewed-by: Haggai Eran