From patchwork Tue Jan 31 12:17:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9547025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 326DE60425 for ; Tue, 31 Jan 2017 12:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22DAD28338 for ; Tue, 31 Jan 2017 12:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15CD728375; Tue, 31 Jan 2017 12:18:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 935C928338 for ; Tue, 31 Jan 2017 12:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbdAaMSs (ORCPT ); Tue, 31 Jan 2017 07:18:48 -0500 Received: from mail-bn3nam01on0058.outbound.protection.outlook.com ([104.47.33.58]:53760 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752043AbdAaMSk (ORCPT ); Tue, 31 Jan 2017 07:18:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wiwR2b4v9cQ6Ty3iCqxYH0LvaWlYmxp2l9zNc2xrolU=; b=PFIhwKWcJNY+z951dtSIzvTrgwbh1YAugByYdZDjtaA2OMKcNDyoCl1wVF0IxFJr9bspo9wRApfdpAFTfIJVmy5+w3k6bK713K5480ivq3XiBjT9b8OO2Y5qjVT9cy4+OWG2NXt0Msupf1NqSUGnqbAOSnfHUfjgpGekdFklfJ4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matias@cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by DM5PR06MB2777.namprd06.prod.outlook.com (10.175.107.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Tue, 31 Jan 2017 12:18:01 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 11/12] lightnvm: free properly on target creation error Date: Tue, 31 Jan 2017 13:17:19 +0100 Message-ID: <20170131121720.10971-12-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170131121720.10971-1-matias@cnexlabs.com> References: <20170131121720.10971-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: DB6PR0601CA0024.eurprd06.prod.outlook.com (10.168.88.162) To DM5PR06MB2777.namprd06.prod.outlook.com (10.175.107.139) X-MS-Office365-Filtering-Correlation-Id: bcb89b06-8825-4c3a-a8d4-08d449d333d4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 3:b4iYQT9XlujaJl5JXaHQbbjICxQ89PRx1h68Qn6pxug8KfbCQ7BXWo1O92gQH5tArsn81x/8sOJZITa5dhI/cOLbpygYIFjizpXF9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1AA+lq7q2s4Sim6VJAxOuidmVd8a9yeTJrKs10= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:DM5PR06MB2777; BCL:0; PCL:0; RULEID:; SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 4:NYctXf76NIh+KNgr2GM+PbMstoa4mFHNJ1Oc9nLHH8N1p3PEKr/PeuaOHiZ/fzbB0ZuKG8lEZcNBz4zv6l7zt3wd2sFqvawl8Tx1/ry2NAxn/UiGOMMHaXPL3iRskbEiwug3vDdwoUPQxKMTS/FJAvm5u7ZLd2Xkq9tz/yiEP7xp7uzthrDqV7lf4SUcPXZfYmGJYfg4MX1A6rS+LpLfUJSfW0frezDkoLpOFgp5/MQfFrUIBl3KElQuxXH9tyUrXt3t3XaCW9wOEXhydTksbB4lsjMYvF3WESS1rmFoXyRC0m8FquzlGoo5E+W4ywQlMIhCWlf0Oqhj3yG4vCoZ3OS4Dmj9wTz/GKuyEXaP8ze7CL4E+iUQnznhA1KrxlcGuHyQcqm3xQuUNE8jAaF+y4m5fZPP+uqixeTUn7Y/aUbPAwMBRo6TIZ65aUxYKfdIUqsxsry9NHLPROsDdgbACZPKp6/zb8/EGxBRFa86v9Nrt+Wn9gv5T3eSCdMv95ReI0wHT7tO8v+JDZkj3gtDzlgWGKFU6Y1QdDsO1CaEX/6LVXbeuNSafq0HRNbbt+pM X-Forefront-PRVS: 0204F0BDE2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(189002)(51234002)(199003)(42186005)(66066001)(50466002)(6486002)(47776003)(38730400001)(105586002)(54906002)(25786008)(106356001)(2351001)(36756003)(68736007)(4001430100002)(53416004)(50986999)(107886002)(7736002)(2906002)(305945005)(4326007)(110136003)(23676002)(2870700001)(189998001)(5660300001)(92566002)(86362001)(1076002)(6116002)(3846002)(33646002)(6916009)(97736004)(2950100002)(5820100001)(6666003)(76176999)(101416001)(53936002)(81166006)(81156014)(8676002)(50226002)(69596002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR06MB2777; H:skyninja.cnexlabs.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cnexlabs.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjA2TUIyNzc3OzIzOmNPeTJtVnVLSi9lQlN5ajI3TjM5LzdXMmZM?= =?utf-8?B?UlBlSkdkTXJRSk5JTmdBbW1ubGE3YUdQNDhqaC9nTi9MUTRBcUE1QlRwakFU?= =?utf-8?B?NVAvWWhTV3ZWVjFuTTFlRWdGR2xOTmpmK3R5QTg5cXhXWktNa0VJWFZEa25z?= =?utf-8?B?OEl0Wkl0SlBxTGJoOFo4eDBiR0xMV2ROcEt0Y2Q0T3pqM3BSUmFmeHRJckpv?= =?utf-8?B?OW9pU0ZTdmhwK3BoTi9QOHUzNnBCZHNIdDJOenNXSXRNaXZBTWx6QjhFNTNt?= =?utf-8?B?TzZpalBTUnRHS0lyMWgyN1hEUkVQZU1oZjg5OHZYUERqRmgyUkErWDN2a2ly?= =?utf-8?B?Rm9mYlVTckRLb3RsL21IbG8vRDdjeVJvYTc4cmVuU1JyLzNOazFXdit0YmZI?= =?utf-8?B?Zkw1aTBBNThRQ2F5TklUTDc4TjRGQnlBUGhPVmtrVnlBWUM5M1lXWk5QMFdw?= =?utf-8?B?TS9WVVRJVnJiRlBJRytwMmdHVE02emNTYW04Qy9SVnhSOGNSTGlzVFY5WFd4?= =?utf-8?B?OHpkdmhCNFl3aStQcERaY3FlTmIwSENhR0ZKNHhEZTlmaUg2bzNRaktwN2to?= =?utf-8?B?M3h2Yk54WmxaN2NIeU1QeGd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yMVVOcG4xeXp5S3g5U3BkRUViYjl2SERuTjcxR1lrWDZ3Vk9TSEdm?= =?utf-8?B?TUtaWVdzRVRKRUx2RU1tNnlIZ0VUZ09ndFNTSDlrbm1LYnhtYitkUUhZQjJF?= =?utf-8?B?anIzbTRJemN5RjlRdnJFbmtqdmYwYW1kRWJJWFo1U2xJdFBsT0J6KzEreTlr?= =?utf-8?Q?HPXqQxIGDQfEqgV+mTY2+l2DBXRdLb5Y51yYFdd?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 6:eZ0vuzGKFv/uW2ecqU8uzs5UbYVIuJx3PSe+jkoqiq+MtmjeCJudHQr7jWMZgyjrxOWW5JynvKjD2h838S2k4Zv9WpGCzNBf4+wCILTrR5YgPC99r964osl0AWuMlfGkykXRsZcb27knXK5QPO2J3TUf668uu746x3qswv3IIrsw9uzhGd1dU6QbITTbPuVUt55ke10GyU1DY/GthLIPVNwBXOA+PDo03z/4zmK8+pCDk/N/K5zLg+jt1EaelvwOh2ENuFzvMn//WPzYht9iKAaM+3edsVOv+mw4s3BkWH5TdHhqQGoVGgM9+n4vh0axFYcTCK/eSkapK1LOPaGUcWDdyvth9g2XW2PhsG92QVDE8JNrvYetrz0S/y3kXum4w63U8Cl0D8q4wuBhI7JmqblDVikejDhZ771edEPS5ag=; 5:cars7iSOQKvIhtt7NOo8CzjSCvcqKCcjr/WnLGthBcMQdfLEhA9jjjVpWtIum5XkSFUfGTviC9NSApO5lDEeZ+pP/OJUM+OgYhUCx6nn7IJerMweeU8K12Jp1Zn3KccN/svsknT/wpGTdMIb3NmANg==; 24:Gaucu+mQUApnFq0zEQluI5roHMca5vW8xL/XBpk/F4PBlRmGddPfRNKMBby7vK6D+nzf6QTb1CmtDB15vbrlccVTNjfzbLJQupvqsmfrsyc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 7:I+/p8t5zvGssQxwYG32IjDHCsnfooGxeh0lMBvFaJrE4hognzU070BUBeMPhNpF0ndn+5/ZMgNlh1FhkWW4STo4IUP2TX6l2HJyzsoyudRn15RIshXPHsR1CAxelltluhyqYqh0lNWeySsqrktFE9tEQP5dX3Rdj9sQti01KXwdidtnR26T46yJIKxrINZWAkGdseaKJsZ5edTTRvcl9wYXOJRv+fFKn2idmZI0YzUeOwVRabzckE9yJ9iWPVnKF/D6/trT/NQWiQJLV2U6PeAYHW0gCW6WFR+JB+rJOMhrkJcl3oi5UV46cnVctNAgyQvikh2GxZgcCAMxM+IN9JFxCOXNL+WnKTP/RqgSNMHIAdKI/r6OHCCWgW1YzlxQ0iOi4Bo+H1QklDQt0lOUhA+5jDxZU9rCDB9RcvZsc+FIbZrLJX3YbZeBLjiaqYmSN77deBgFUYqCPEO8fS6XQwVUtA6gAX/k9m9fgkkvOo7rwUDNIWXupPW/gAX9SpIN/DB8jlLetYQOP8/jTD1RiMbijnlJKSXwd8H7wczptEhD1DWuHBhnIhD9eJ5Fy6Ceu X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2017 12:18:01.1555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR06MB2777 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González Fix a memory leak when target creation fails. More specifically, free the entire device structure given to the target (tgt_dev). Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 4f4db99..b2cd3d6 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -303,7 +303,7 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create) err_queue: blk_cleanup_queue(tqueue); err_dev: - kfree(tgt_dev); + nvm_remove_tgt_dev(tgt_dev); err_t: kfree(t); err_reserve: