Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2426124imm; Thu, 9 Aug 2018 12:42:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwCsju+XdUGvx6981yToZWY9xzgOlrfgivaEise+6a2MyyrmTwoGOudCdEvPWT80dAc10iF X-Received: by 2002:a62:6eca:: with SMTP id j193-v6mr3763173pfc.256.1533843746947; Thu, 09 Aug 2018 12:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533843746; cv=none; d=google.com; s=arc-20160816; b=MKPsARKvHYCCb2GgCfhLGVgcilQeBryNmO6AJzXUGJnS0r5FyVxBrvYjIR8rITwYgy Q+rD3nx+ipAKpr8Serp88r0BYVmhruJslZVWF5TtI73+FJr79MD+MOI+Jnpq1GGQGjKA gJtc3HdrD1MqmcePrGDxH2+Gtt6ACK0nsbXWu2Fc19fNXLgMEfQf00y9J2PF6LPbPHeF sQDEpoeDIGU/pykdIITKP9tG4fBk/sN1BcRNlwCzcG4H2eoYQHdq3/WDnfsGbYnQYdkc InZ98XexdaSRXWdv6QILXA1zczfXTi7EI7JmK8eJQ8RLPppc7MVsnZf6ri3vEqH9yp4Z dURA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=GhsNkLOvHOcBXrF6L6DK61XYSklSLF8ro3RgmvIo9no=; b=E7jdzj7aEuVtm4TPewPdD+0jIEfTaYunRJezoajK7Hq5f+bZ5dsq+MJYGr3XPd8tMa MAjUgSE/ow730rc1/opplZdcjDMp4ZdVqOz+kN3YaIiU4fAF9Y6w3gR0IF53dhQ/ZR8s pPN8ldOd2TzFwgoxyuUoDjnTDscnj+7fKcom1XxZAWVy+pYXn07ViP4+gjuW5UfLf8nt sUNdar+Jun3B1LXdccONFnWJ0SO2Vi85xXWUY3kIIc5iEmplHincBrsMH2UuzJiUo8qS RvJeStZt/jI2ojQ7QUUFXwTeGcXZ6ttDoSM9rlYNifBNhIP3yXSwUBtKK3O1EC58Uzlb 07Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WisFlvqD; 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 37-v6si6873780ple.169.2018.08.09.12.42.11; Thu, 09 Aug 2018 12:42:26 -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=WisFlvqD; 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 S1727121AbeHIWGv (ORCPT + 99 others); Thu, 9 Aug 2018 18:06:51 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45960 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbeHIWGu (ORCPT ); Thu, 9 Aug 2018 18:06:50 -0400 Received: by mail-pg1-f196.google.com with SMTP id f1-v6so3201093pgq.12 for ; Thu, 09 Aug 2018 12:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:to:from:in-reply-to:cc :references:message-id:user-agent:subject:date; bh=GhsNkLOvHOcBXrF6L6DK61XYSklSLF8ro3RgmvIo9no=; b=WisFlvqDaj5KbfR2JovaMGqsjjgIvBT4ZfiX/sAruF3iiljv6lVjD0Cdb4zT9G1Pua Lvv3CLOMXpkHn/L220lSbiEeo/kGJqxj3iF52/fz4AM7yjWA+rzVnxmgGgvC+QkVvJqd QA8ROxA2puTiBgGFS1hHXYJIQ3WWRC6jnmHl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding:to:from :in-reply-to:cc:references:message-id:user-agent:subject:date; bh=GhsNkLOvHOcBXrF6L6DK61XYSklSLF8ro3RgmvIo9no=; b=L730mWhDtwVBUOiwpfFaRkEwZ2eQHhS5FTLET+1ZXW3KQ50MQZCqG0EcVoRC4e8s6/ sLJXtPXllCrogMZXqUiV7NN5JH9Ogeerar/sIGD+q/7j1vnenkj+SGTOcbe441UJ7HVR WLjv3aREbR1m8tE8t9pHqY1xww+qFjbvJxizdfByZ0enGTq4a9OzqbhtUuEO1gyeOl/E BC83ZCTBwfxg7Ihpg+t48p2H84oUKK2kAzBKhh+olYWlrQd67XKo8FajOYwRh+DOl3qR 5eN3IBIrcwWjG26yScESMCRV18+0XFUM9OZmUPwMVOVfUf2Iq5Qad5S3zKoUd/aOmnRC Y9Uw== X-Gm-Message-State: AOUpUlGoseiFWSuMzjJawcJFXL1X5+7ySPZ7zhHuF0IPENTBUiVSM9HF YECcxN2+LIo9G+1ZCqf6MW8NHA== X-Received: by 2002:a62:4fd9:: with SMTP id f86-v6mr3709754pfj.110.1533843632488; Thu, 09 Aug 2018 12:40:32 -0700 (PDT) Received: from localhost ([2620:15c:202:201:7e28:b9f3:6afc:5326]) by smtp.gmail.com with ESMTPSA id c4-v6sm13343899pfb.71.2018.08.09.12.40.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 12:40:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Brian Norris From: Stephen Boyd In-Reply-To: <20180809174936.GC129285@ban.mtv.corp.google.com> Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Wei-Ning Huang , Julius Werner , Samuel Holland References: <20180809171722.144325-1-swboyd@chromium.org> <20180809171722.144325-3-swboyd@chromium.org> <20180809174936.GC129285@ban.mtv.corp.google.com> Message-ID: <153384363124.220756.3747855789935101539@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH v3 2/7] firmware: coreboot: Unmap ioregion on failure Date: Thu, 09 Aug 2018 12:40:31 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Brian Norris (2018-08-09 10:49:38) > 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/firmwar= e/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 +=3D 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: The memory is copied out of the table. So do the devices actually use the memory that we remap here? I don't see how it's a problem if we unmap the table after we populate devices. > = > 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 > = Thanks!