Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751041AbdIKIZa (ORCPT ); Mon, 11 Sep 2017 04:25:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39326 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbdIKIZ2 (ORCPT ); Mon, 11 Sep 2017 04:25:28 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 566F523737E Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dyoung@redhat.com Date: Mon, 11 Sep 2017 16:25:17 +0800 From: Dave Young To: AKASHI Takahiro Cc: catalin.marinas@arm.com, will.deacon@arm.com, bauerman@linux.vnet.ibm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, akpm@linux-foundation.org, mpe@ellerman.id.au, bhe@redhat.com, arnd@arndb.de, ard.biesheuvel@linaro.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 6/9] arm64: kexec_file: load initrd, device-tree and purgatory segments Message-ID: <20170911082517.GA25352@dhcp-128-65.nay.redhat.com> References: <20170908031616.17916-1-takahiro.akashi@linaro.org> <20170908031616.17916-7-takahiro.akashi@linaro.org> <20170911064754.GA7332@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170911064754.GA7332@dhcp-128-65.nay.redhat.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 11 Sep 2017 08:25:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1683 Lines: 61 > > +int arch_kimage_file_post_load_cleanup(struct kimage *image) > > +{ > > + vfree(image->arch.dtb_buf); > > + image->arch.dtb_buf = NULL; > > + > > + vfree(image->arch.elf_headers); > > + image->arch.elf_headers = NULL; > > + image->arch.elf_headers_sz = 0; > > + > > + if (!image->fops || !image->fops->cleanup) > > + return 0; > > + > > + return image->fops->cleanup(image->image_loader_data); > > +} > > + > > +#ifdef CONFIG_KEXEC_VERIFY_SIG > > +int arch_kexec_kernel_verify_sig(struct kimage *image, void *kernel, > > + unsigned long kernel_len) > > +{ > > + if (!image->fops || !image->fops->verify_sig) { > > + pr_debug("kernel loader does not support signature verification.\n"); > > + return -EKEYREJECTED; > > + } > > + > > + return image->fops->verify_sig(kernel, kernel_len); > > +} > > > arch_kexec_kernel_verify_sig now be duplicated so it can be put in the > general function in kexec_file.c > > Also the probe and load function are also duplicated, they can be moved > to common code as well. > > The x86 load function can be cleaned up with removing the vfree > callback. > > --- > arch/x86/kernel/machine_kexec_64.c | 3 --- > 1 file changed, 3 deletions(-) > > --- linux-x86.orig/arch/x86/kernel/machine_kexec_64.c > +++ linux-x86/arch/x86/kernel/machine_kexec_64.c > @@ -384,9 +384,6 @@ int arch_kexec_kernel_image_probe(struct > > void *arch_kexec_kernel_image_load(struct kimage *image) > { > - vfree(image->arch.elf_headers); > - image->arch.elf_headers = NULL; > - Hmm, should move above to arch_kimage_file_post_load_cleanup instead.. > if (!image->fops || !image->fops->load) > return ERR_PTR(-ENOEXEC); > > Thanks Dave