From patchwork Fri Nov 20 19:04:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 7670811 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B2C56BF90C for ; Fri, 20 Nov 2015 19:04:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA99920425 for ; Fri, 20 Nov 2015 19:04:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3C572041F for ; Fri, 20 Nov 2015 19:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760141AbbKTTER (ORCPT ); Fri, 20 Nov 2015 14:04:17 -0500 Received: from mail-bl2on0083.outbound.protection.outlook.com ([65.55.169.83]:35184 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751654AbbKTTEQ (ORCPT ); Fri, 20 Nov 2015 14:04:16 -0500 Received: from BN1PR02CA0052.namprd02.prod.outlook.com (10.141.56.52) by CY1PR0201MB0826.namprd02.prod.outlook.com (10.160.141.27) with Microsoft SMTP Server (TLS) id 15.1.325.17; Fri, 20 Nov 2015 19:04:14 +0000 Received: from BL2FFO11FD038.protection.gbl (2a01:111:f400:7c09::100) by BN1PR02CA0052.outlook.office365.com (2a01:111:e400:2a::52) with Microsoft SMTP Server (TLS) id 15.1.325.17 via Frontend Transport; Fri, 20 Nov 2015 19:04:13 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BL2FFO11FD038.mail.protection.outlook.com (10.173.161.134) with Microsoft SMTP Server id 15.1.331.11 via Frontend Transport; Fri, 20 Nov 2015 19:04:13 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 77.9B.32178.CAE6F465; Fri, 20 Nov 2015 11:04:12 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Fri, 20 Nov 2015 11:04:13 -0800 X-AuditID: ac160a69-f79f76d000007db2-a7-564f6eac4bdc Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id F8.46.04661.CAE6F465; Fri, 20 Nov 2015 11:04:12 -0800 (PST) To: Doug Ledford CC: Haggai Eran , "linux-rdma@vger.kernel.org" From: Bart Van Assche Subject: [PATCH] IB/cma: Add a missing rcu_read_unlock() Message-ID: <564F6EAC.7070608@sandisk.com> Date: Fri, 20 Nov 2015 11:04:12 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRmVeSWpSXmKPExsWyRoxnke6aPP8wg7kTzSxenv/AanF8qbXF s0O9LA7MHs+mH2byeL/vKpvH501yAcxRXDYpqTmZZalF+nYJXBlNs3sYC1rZKw5vfsnUwPiV tYuRk0NCwESip2M5M4QtJnHh3nq2LkYuDiGBE4wS7xZdYIRwdjBKTPj+iRmm48i7cywgtpDA JkaJ6bcsQWwRATWJTa8WsYPYzALJEjsOLAWrYRMwkvj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/kq3ZFK LMUZiYZazEXFiQD15H4S4AEAAA== X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD038; 1:gCENsBRYM4Y4GAXSVv81HmE8lx8x86k9Us3Y37c6SItnf1wlEbUuzgM4DB7U55sprYbNlxa5LrmzZRLAs7G1PtVitNdq6u2Uxxb15AGv8Z/AEo6dWaE96AL48VvNMptEmVmqR84+1CyDiN0mVa1K49Nx/TTrr/28LxV5rFHBViTe+h60F235et1EOiArowvXp2fqwck846HmP3wyZUvIGaB+CNgYL2WMOlmAtHk88cW1grvO1rOFq+9CR59rchoSnotRKVt4BbSz9cLQjTkTM84o71f6qLkPh2RQpiYyeP6tzErz0QJxkFPzj63DAFNAUYldXR+FOOEiqpHXfmnGvwDkDR8VTIlXLUCDZXEl/PHjya/8ZzNv/7MPpCYxxmN4 X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(77096005)(5008740100001)(50466002)(65816999)(23676002)(97736004)(92566002)(87936001)(11100500001)(59896002)(33656002)(54356999)(83506001)(87266999)(230700001)(229853001)(106466001)(86362001)(36756003)(5007970100001)(50986999)(189998001)(80316001)(65956001)(65806001)(4001350100001)(586003)(69596002)(5001960100002)(19580405001)(64126003)(110136002)(47776003)(81156007)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0826; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0826; 2:TA2EFEtxExkIvaeH/MTZ3qX4Mo1t4/R3Erkv7pMZBNwPJhG7zpV8y1H6P5esyNOMOS3nXIqpYgvJUo0ymNAG6c/fzr/Bugj4ORw5hDP/XbkQoylvgENESOWDAauJ3jZ8DlJ+pALI+ZHzjlHtkefUsj+/b6yAxcSCn79/kPzhqMw=; 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HQwmd1QKnBhgVRNUTQy1kJf70/A8Ey1WwTKHBNZn3YGniQHoSdC6X1Tfotct7nL3lyot9e25aTs6T; 4:j7jgKWHbOAUppujTvtYiUDGdkWMRIoi3AL20vyMh0Y1DJ9p8iINMrkaI30lOiC/2+v9uv0PiTZG47VfE/KTTAgylnsRakDh9BnqRCJk2FwzjtvoPdvrlEo1Zjs9NmlJkXAiJZcmCXV+u0Z4PtMN4bKbfJ7FtmbkWFvS0Mikd/lWxB6oDfPNAanlxDPQugjkNaByg1XJhz7Ah6VD3wCRxIkrZCCKPOL9+HoHqo8I5hzgVyV8dENImsq3nee8VOCUrdhjbzhCJcpDkcDckXxBigmQMVTVSHkbQYQ84xNNiw0yJTf2WfAsj8pvJKqJsUUUEGI+zbpWE/ArDsgoEP9uPBzWZzD+7NjkPMvl19h4SUqdW6NTY9N12z28GdrLDSX7w X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(34787635062028); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:CY1PR0201MB0826; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB0826; X-Forefront-PRVS: 07665BE9D1 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyMDFNQjA4MjY7MjM6OGpsVll4WWV0Zm9SanVzanlNdS9RRXIy?= =?utf-8?B?akY3VXB3SGJqMStrUXc1YXFpdDZsUTZnZFVXOWdnSWpRYk10RWhoMStkZFJU?= =?utf-8?B?NVdUOCtXeFo2YTdnRGVocXVGMjNJVEJRSW00TnJDSVJvR3RSOFpuSUdRZk5o?= =?utf-8?B?djh1OXBSRFZlaDVhMTcrZW1tWTZvbWVyakNTZExGZ0NhRDUzVFVxRTBkelNj?= =?utf-8?B?enFkL0lHZEJZaHNnOWVMSzluSGp5MjhpNEo5T0ZXUHI1NkhXL0ZadXhod0Ix?= =?utf-8?B?TjZwcnE1M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cUFP?= =?utf-8?B?YVBjYUQzck0xbnRFK1QzcG5nRmpoK0Y4QWNLVmtncnU4cGRKcjBYOS9hd0VZ?= =?utf-8?B?TmNaVHZWakROVkVwcHo1VGdoQm5tY3dWWlJwL2hvdlY1QzRmN0JtbGgvVkN0?= =?utf-8?B?dHpDZXpFSlYvQS9ZMjBod1pzdVdmZE0vNnRPMk1YZW5sbzVEUTFSMm1FN1R4?= =?utf-8?B?WGxsaGorTGg4NWdxaVVCQ0c4elpDRmN6MmpwVlRJaE5PR0ZmdXdMZVBScWFI?= =?utf-8?Q?8E+OE+DlKlzgMZgf3khr1PCoOrRFR?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0826; 5:kH2T0jCTgS4yWKbV+9yLx0HrRG4wvzwUI4yB7u7zoKq3o/LigXW//NZAyy9ojFuvvVaTMSnPgbPwJh4Lv+R8biQHfwIMwJcQhkVzYF8LOVYn7D5Vni5kiPtQ27jguKDsTN/DfzNJ300s+toM/PSzXw==; 24:kSreqY9aotyn/uW+zdo7PdATrdgja58d/vUrH20i2hL+T/0heBVdeQGg04ajUdwJwJF4SNB+aHFQ1Rjt8LbCwDECDmdHNqOkd0c42QvLWNY=; 20:fL7Cjg9/xjn6RRgCJinQR1mNdOEqnZHUblHG/W4hxS5h3UdQ88JJnqKBeItOqZev8QdFbsIPICl3g0aHaxOrfJejPovwqzZApN4bw7XytjXfw6/+jjN0/ScbQCGPtlfqUgQcQSSSyoPV6M6Hmn0L3A5rj4uDKQvNBcjPVw58SNDiyk24HX/N0Ywn6pp7Hq/ObehFpvNj4E+nausQUD1zre+wEKVGazvI5Zbvz1iPoNoOWqOjFK6ay6WZu9SF1IWv SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 19:04:13.2204 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB0826 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that validate_ipv4_net_dev() calls rcu_read_unlock() if fib_lookup() fails. Detected by sparse. Compile-tested only. Fixes: "IB/cma: Validate routing of incoming requests" (commit f887f2ac87c2). Cc: Haggai Eran Cc: stable Reviewed-by: Sagi Grimberg Reviewed-by: Haggai Eran Reviewed-by: Jason Gunthorpe --- drivers/infiniband/core/cma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 69e5477..f8dfc63 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -1126,10 +1126,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev, rcu_read_lock(); err = fib_lookup(dev_net(net_dev), &fl4, &res, 0); - if (err) - return false; - - ret = FIB_RES_DEV(res) == net_dev; + ret = err == 0 && FIB_RES_DEV(res) == net_dev; rcu_read_unlock(); return ret;