From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA030C47404 for ; Fri, 11 Oct 2019 18:18:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9BBE820673 for ; Fri, 11 Oct 2019 18:18:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BBE820673 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 513A36B0003; Fri, 11 Oct 2019 14:18:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C54D8E0008; Fri, 11 Oct 2019 14:18:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 363688E0007; Fri, 11 Oct 2019 14:18:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id 10CD46B0003 for ; Fri, 11 Oct 2019 14:18:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id AAF5D1EF3 for ; Fri, 11 Oct 2019 18:18:00 +0000 (UTC) X-FDA: 76032312720.15.pear21_801ac6ffa2d0c X-HE-Tag: pear21_801ac6ffa2d0c X-Filterd-Recvd-Size: 3223 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 11 Oct 2019 18:18:00 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3764F1570; Fri, 11 Oct 2019 11:17:59 -0700 (PDT) Received: from [10.1.196.105] (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4B3BD3F703; Fri, 11 Oct 2019 11:17:57 -0700 (PDT) Subject: Re: [PATCH v6 03/17] arm64: hibernate: check pgd table allocation To: Pavel Tatashin References: <20191004185234.31471-1-pasha.tatashin@soleen.com> <20191004185234.31471-4-pasha.tatashin@soleen.com> From: James Morse Cc: jmorris@namei.org, sashal@kernel.org, ebiederm@xmission.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, corbet@lwn.net, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, marc.zyngier@arm.com, vladimir.murzin@arm.com, matthias.bgg@gmail.com, bhsharma@redhat.com, linux-mm@kvack.org, mark.rutland@arm.com Message-ID: Date: Fri, 11 Oct 2019 19:17:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191004185234.31471-4-pasha.tatashin@soleen.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Pavel, On 04/10/2019 19:52, Pavel Tatashin wrote: > There is a bug in create_safe_exec_page(), when page table is allocated > it is not checked that table is allocated successfully: > > But it is dereferenced in: pgd_none(READ_ONCE(*pgdp)). Check that > allocation was successful. > Fixes: 82869ac57b5d ("arm64: kernel: Add support for hibernate/suspend-to-disk") > > Signed-off-by: Pavel Tatashin Nit: Please remove the stray newline so all the tags appear together. > diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c > index d52f69462c8f..ef46ce66d7e8 100644 > --- a/arch/arm64/kernel/hibernate.c > +++ b/arch/arm64/kernel/hibernate.c > @@ -217,6 +217,11 @@ static int create_safe_exec_page(void *src_start, size_t length, > __flush_icache_range(dst, dst + length); > > trans_pgd = allocator(mask); > + if (!trans_pgd) { > + rc = -ENOMEM; > + goto out; > + } > + > pgdp = pgd_offset_raw(trans_pgd, dst_addr); > if (pgd_none(READ_ONCE(*pgdp))) { > pudp = allocator(mask); > Thanks for splitting [0] into two ... but this fix depends on the previous patch - which isn't an issue that anyone can hit, and doesn't match Greg's 'stable-kernel-rules'. Please separate out this patch - and post it on its own as a stand-alone fix that can be sent to the stable trees. Mixing fixes with other patches leads to problems like this. It isn't possible to pick this fix independently of the cleanup in the previous patch. Thanks, James [0] https://lore.kernel.org/linux-arm-kernel/ddd81093-89fc-5146-0b33-ad3bd9a1c10c@arm.com/