Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2322907imm; Thu, 9 Aug 2018 10:51:35 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxL9gkrymUyTjrwvPytHnJSl2Y2dBXAGNdw91qToq8z216uG708T3KIyerF6lBbAB2oXhKs X-Received: by 2002:a63:555:: with SMTP id 82-v6mr3159913pgf.25.1533837095704; Thu, 09 Aug 2018 10:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533837095; cv=none; d=google.com; s=arc-20160816; b=A48eCPaaC7iUPeEMoYoOFpgX27TChK9Als128N0LQrfg3H16IOYGbqCZFCG/fxneWE N6SedK+6OVJ/tyiHMypxYeWhe9fTiK8XgUwYI6Qtz36E9KUZmcismonq/Uc5e4ckP0wO E1NE4xF5f2+ED0tt8Xgu+hjJrnki2cGQq4/4NpwGksLK4Lf6OORQa02K+IKFy5wjrNar 38SfZ6Z1JDRDKxz/OqPivGbKs+fFN3JAR1bmB3NnpscyXu/ezkmvzb+s8H5EgOFeU8MA RpDijUEGKo0EhAHVz43dXNkcZtsmPpmlSAknWA2a6ayOtlPOpRvRff1l0o4mkVaI181V 9J/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=huIdhvc31zB8/Q083cdPlHCFVCmDNsdTuSlR1lc3GSU=; b=LMZAsnEz9oJtlbxFtOiQwkvs92f7YCr8j/xSU4rWF2Rbcs/saFfsVgjOaSY4GDyiea px7seobagD0UfBwD8GbbCSWJ9R643PUL2VnrsHDVy7YMiTwFkOZBmItm9IJMXsm6Zwt4 BNGmMsLC5Mo5mFkjn7xlqXxCxJ7dY/3TMvXI9HcQ6Rb7pUe5QF/h5yeuhlfwDilYUBSY dqgkq8gL3HFbyGaXD3rAF1YEqhkp59DAj7IP6qTit5U5gj1itGrhJIEKHFfp5aXS4Yj9 lnXvhxEFccacryea/5M28hfSJzhzdRNTlNwcXdqmM8Vz+IsU86T8KY2CIYgxeGXsUUpY xj/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Oa2yj/fk"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z18-v6si7878675pfl.209.2018.08.09.10.51.20; Thu, 09 Aug 2018 10:51:35 -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; dkim=pass header.i=@chromium.org header.s=google header.b="Oa2yj/fk"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732682AbeHIUPh (ORCPT + 99 others); Thu, 9 Aug 2018 16:15:37 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35735 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732496AbeHIUPh (ORCPT ); Thu, 9 Aug 2018 16:15:37 -0400 Received: by mail-pf1-f194.google.com with SMTP id p12-v6so3201432pfh.2 for ; Thu, 09 Aug 2018 10:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=huIdhvc31zB8/Q083cdPlHCFVCmDNsdTuSlR1lc3GSU=; b=Oa2yj/fkQIyGPN4upHFmFAl/lI3qBYvExBHsJHoSTxeD3bI/PoAtGncdL8kAwUxY7c kZ8FnH166BjuXwgmZfglFbUhpfqR7UGT3Gg5CybUzymeLxdKC0kgBwOiNqrRTRcxZt2s P6/xxAbLxzSYPAFHKfytWjs9N8XRXpqepNiEY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=huIdhvc31zB8/Q083cdPlHCFVCmDNsdTuSlR1lc3GSU=; b=P+xI35DYqdmr4EEHHVbP8dbuhJRLqWsR10q8/v7kNgfcyjsfzjyfVUdnFplFgzhepI SKMl9t2udhRKm3zvB0a9QUGWSOskM/F9HLiL54muzlfuB5NT6rUwivZcQePqMREdk58l OnbaskYSbdEFQ3tMS0mSNUhVgd2H85JNBS4x7DqER7TWYOt3PV4nrxaJ4KzfGy9DSB0/ JM9mt7so127J603ZXqbCL/j6sBuXhe5goQ41slkchr48TXedMUYrNcHOzgLS4UM3n6l0 VvAYwU/YQ75s8i59Q9DNHxSDyKDVNZiILmiAeGEm8Egj8TWTLVLW22LF0aTkSLNloklN XG9w== X-Gm-Message-State: AOUpUlGuLZWx8Y9yAYNjH0c8YYAungZAel9pWKSJoAoVPysfi4Hsr0Fn S2lLwlOt+ICdlmuFeCl7m0/13A== X-Received: by 2002:a63:3d41:: with SMTP id k62-v6mr3096258pga.254.1533836981776; Thu, 09 Aug 2018 10:49:41 -0700 (PDT) Received: from ban.mtv.corp.google.com ([2620:15c:202:1:299d:6b87:5478:d28a]) by smtp.gmail.com with ESMTPSA id u11-v6sm13755492pfd.117.2018.08.09.10.49.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 10:49:40 -0700 (PDT) Date: Thu, 9 Aug 2018 10:49:38 -0700 From: Brian Norris To: Stephen Boyd Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Wei-Ning Huang , Julius Werner , Samuel Holland Subject: Re: [PATCH v3 2/7] firmware: coreboot: Unmap ioregion on failure Message-ID: <20180809174936.GC129285@ban.mtv.corp.google.com> References: <20180809171722.144325-1-swboyd@chromium.org> <20180809171722.144325-3-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180809171722.144325-3-swboyd@chromium.org> User-Agent: Mutt/1.10.1+48 (1f3a9df87d11) (2018-07-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 09, 2018 at 10:17:17AM -0700, Stephen Boyd wrote: > Both callers of coreboot_table_init() ioremap the pointer that comes in > but they don't unmap the memory on failure. Both of them also fail probe > immediately with the return value of coreboot_table_init(), leaking a > mapping when it fails. Plug the leak so the mapping isn't left unused. > > Cc: Wei-Ning Huang > Cc: Julius Werner > Cc: Brian Norris > Cc: Samuel Holland > Fixes: 570d30c2823f ("firmware: coreboot: Expose the coreboot table as a bus") I suppose this is fair, since that commit introduced error paths and didn't clean them up. But one warning below: > Signed-off-by: Stephen Boyd > --- > drivers/firmware/google/coreboot_table.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c > index 19db5709ae28..0d3e140444ae 100644 > --- a/drivers/firmware/google/coreboot_table.c > +++ b/drivers/firmware/google/coreboot_table.c > @@ -138,6 +138,9 @@ int coreboot_table_init(struct device *dev, void __iomem *ptr) > ptr_entry += entry.size; > } > > + if (ret) > + iounmap(ptr); This works because no sub-driver is using this mapping any more (i.e., because we killed coreboot_table_find()). Otherwise, we'd need to explicitly kill all the sub-devices first. IOW, if this gets backported to older kernels, it would need to go along with this and its other dependencies: b616cf53aa7a firmware: coreboot: Remove unused coreboot_table_find But I guess that's a question for -stable. Or, we remove the 'Fixes' tag? Or add another tag, to list other dependencies? Or just ignore it. But for this change as applied to mainline: Reviewed-by: Brian Norris > + > return ret; > } > EXPORT_SYMBOL(coreboot_table_init); > -- > Sent by a computer through tubes >