From patchwork Tue Mar 6 04:56:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 10260729 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 4E96B6037E for ; Tue, 6 Mar 2018 04:58:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DB2628B76 for ; Tue, 6 Mar 2018 04:58:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C19428DC3; Tue, 6 Mar 2018 04:58:14 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FB9D28B76 for ; Tue, 6 Mar 2018 04:58:13 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5291A223522BE; Mon, 5 Mar 2018 20:51:59 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::242; helo=mail-pl0-x242.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 43F5020954CCE for ; Mon, 5 Mar 2018 20:51:58 -0800 (PST) Received: by mail-pl0-x242.google.com with SMTP id s13-v6so11234312plq.6 for ; Mon, 05 Mar 2018 20:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Mbbe8HH5Y1A769HjkQdjgXtumdIDmIoU2CkMieJ+M50=; b=Vfm7JvshWfpxdup8H1q+gnB4C26hNfQWPwnmYdi3thIhhxNDv6VqrtGLrUn6twrvCz mzxIaxd48urZTnUQ0a9pw65BoaFEY8Zm4xYeqOw3sEpiXKNlXKnwBIku00EHlgkopDV1 HKoLWdgFUgca9+lopc21fwZzmDonCLoK3kMbqvqF5o+WFlUwjOlt//evhqsPecyLyjTO wxFJU+f3dXrsBykuXEHZl/MwNlWFUdjKwIhDc7QcUP/y13nO+G6YXZQJ1zeWmIEWBQRz sYMH8zH5Ndg0HtNmKv/H2TIa+ND/AtolXSGKhP/s16Em+owlRLZ5Gt36WfLAYtMNoREJ OHTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Mbbe8HH5Y1A769HjkQdjgXtumdIDmIoU2CkMieJ+M50=; b=YMM8YpO3j55hizwFJQay4sQ0KnvShpW+bEH1xIBfvoOpFuhZP81/J7pCZ5495oBM7R q6Sq7obNGTbSxM400Qw/D7kY7R0VL7kCASOz772b6gF6dOmYeqckeP0GYe/uT4gexZLD u1lrZ5csjo5O8XVLlAdoF0dyYs1g30rohtszijhMXAP8A0AhxPaGd6sogCnT4PRMQCC+ A0F9Zgz+5Wr6XYR7T3ae5Aw4R9rfEpQORkLKf7k0UYr/Lc0h1ncNRqn8TsLoSs82dTtM VRSo/bYhcJV75zKWy6dzS4AHhD8+HURbYT5w3ZtUzOjRBAcPWicyem4rQU1BVlhXE8iz kOlQ== X-Gm-Message-State: AElRT7GEHVo858Ot9psvzDTUd8OHbT5QfUeilshSQzJVuPAOtn+PzflP UhNBeD5Re6XVgwqsCoVBt+TFh2l7 X-Google-Smtp-Source: AG47ELtsG8JEt4ZPS/DJu9VZPjNQ+dcaDLtJCp1ALxRSuc3DPzO9phu/wB0zOSi1dYDilD1CafydsA== X-Received: by 2002:a17:902:ab93:: with SMTP id f19-v6mr8224716plr.180.1520312291529; Mon, 05 Mar 2018 20:58:11 -0800 (PST) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id c188sm22314676pga.14.2018.03.05.20.58.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 20:58:11 -0800 (PST) From: Oliver O'Halloran To: linux-kernel@vger.kernel.org Subject: [PATCH] kernel/memremap: Remove stale devres_free() call Date: Tue, 6 Mar 2018 15:56:47 +1100 Message-Id: <20180306045647.7784-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christoph Hellwig , linux-nvdimm@lists.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP devm_memremap_pages() was re-worked in e8d513483300 to take a caller allocated struct dev_pagemap as a function parameter. A call to devres_free() was left in the error cleanup path which results in a kernel panic if the remap fails for some reason. Remove it to fix the panic and let devm_memremap_pages() fail gracefully. Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface to use struct dev_pagemap") Cc: Logan Gunthorpe Cc: Christoph Hellwig Cc: Dan Williams Signed-off-by: Oliver O'Halloran Reviewed-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe --- Both in-tree users of devm_memremap_pages() embed dev_pagemap into other structures so this shouldn't cause any leaks. Logan's p2p series does add one usage that assumes pgmap will be freed on error so that'll need fixing. --- kernel/memremap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 4dd4274cabe2..895e6b76b25e 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -427,7 +427,6 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) err_pfn_remap: err_radix: pgmap_radix_release(res, pgoff); - devres_free(pgmap); return ERR_PTR(error); } EXPORT_SYMBOL(devm_memremap_pages);