Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10430626ybi; Wed, 24 Jul 2019 23:05:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFQM1RKy381R27RHm0CWISBPU0DlTSI+7PRoNdJ2kCR1YFhxw5aoAg7bAIvpd8qwTdXpnb X-Received: by 2002:a17:902:403:: with SMTP id 3mr87682915ple.66.1564034709846; Wed, 24 Jul 2019 23:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034709; cv=none; d=google.com; s=arc-20160816; b=wui+Z7rdrVuPhTMPZsIMu0IQtO5NQH+LFlWbSg7/SjK402qLm1bCp5piv30B4sbw5Y /3fb5eo/DlA1uvYBTq6YM+eucSKUA8/tgYK10wYODF93TaBZwytpIcB/ow++YONo1e6X uGP4OFVipMZVCz6C+9GkWubByyj+SML39DKtjHUS82gWvx+YL8uqjYJKFMKEIeyPT950 swnHnjKvAB+nTx2Qw90sMI+aw6eekNaZkYdjfwS8bu/TsO+1GC/GMmmE8Scs3coC7p+U 66BAHVmd4ZY9k/Ob3dfTr8zIEX3UrDpkfPCitym90gaXzv5dyi47nq6ZQKXSLoKanClw 3jEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DQDrpEkz6gcmEixIZUJj4E6V2zcqfteTAVMQ9JPxwuw=; b=lRE2SSggbvgc5AFeUwhi16Pq9m1loU7ONxFkkKbo2VXbQA1JESV6dLT01nSxwu7ZBV UNXNMmoUQ4RxJ4HHFtKvzoZMUW5xQXZNr5tcHSiwDlQbixc5Be934b4dXc0nWFVtVA+E MSOMcwenQ1UbMPlaoqmjEDEVjsb0+XxyussO5+pEFf2CaBPtnp2wrQ2+/D+UUZ3fOkea 7DBAr91vDiKqrz0eu23RvWwLVl5FPov1KeKMu7Wsf51fXxW/bINQC3LXdh4jgjNakdep sBGSX46CiBbuq6tfeZOsRveyGlAMAjKvTaR/ISQ0j62pDouYlqLdWs/zNBnPnYSlaiqC jDqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o6WkR9qd; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si9760977pfc.99.2019.07.24.23.04.54; Wed, 24 Jul 2019 23:05:09 -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=@kernel.org header.s=default header.b=o6WkR9qd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727093AbfGYFrM (ORCPT + 99 others); Thu, 25 Jul 2019 01:47:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:35100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729127AbfGYFrK (ORCPT ); Thu, 25 Jul 2019 01:47:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A246A20657; Thu, 25 Jul 2019 05:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033630; bh=cBK5525LSgCK1wddEnu+bn2FUdMGGqSQJR998Vsv22Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o6WkR9qdzVc9SYU1TghChnIvV8cQFaeb7cgiqFS1IcouIvC11fS9En4QNQMt1/yqM /csfXgqogCp4p4ZFbrw1vm8OcfnYnNCtQss4ztjK5J1PsS5aSWqObCoKbo0/x4SSrS XeAQ7UwPu9vplOhFsuuwrO6pWK9tDKe5N5U/Etd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Michael Ellerman Subject: [PATCH 4.19 258/271] powerpc/pseries: Fix oops in hotplug memory notifier Date: Wed, 24 Jul 2019 21:22:07 +0200 Message-Id: <20190724191717.313860720@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Lynch commit 0aa82c482ab2ece530a6f44897b63b274bb43c8e upstream. During post-migration device tree updates, we can oops in pseries_update_drconf_memory() if the source device tree has an ibm,dynamic-memory-v2 property and the destination has a ibm,dynamic_memory (v1) property. The notifier processes an "update" for the ibm,dynamic-memory property but it's really an add in this scenario. So make sure the old property object is there before dereferencing it. Fixes: 2b31e3aec1db ("powerpc/drmem: Add support for ibm, dynamic-memory-v2 property") Cc: stable@vger.kernel.org # v4.16+ Signed-off-by: Nathan Lynch Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/hotplug-memory.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -1012,6 +1012,9 @@ static int pseries_update_drconf_memory( if (!memblock_size) return -EINVAL; + if (!pr->old_prop) + return 0; + p = (__be32 *) pr->old_prop->value; if (!p) return -EINVAL;