Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10519053ybi; Thu, 25 Jul 2019 00:47:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4ETO3yr3Vbp5Sfcqy8f7rVuVfpMoLT1KQYkvItE/y4WXGts0GTUmug5VFZfxZFbl0SD5o X-Received: by 2002:a62:16:: with SMTP id 22mr15860446pfa.151.1564040826228; Thu, 25 Jul 2019 00:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564040826; cv=none; d=google.com; s=arc-20160816; b=OUq4oc7w+boIvP5RZNbW6+ihAT1wErAxaQIrHB7N2OkQXbBJsBO8R+8e/fOp8qlfJt tK09PgVyqDwqUHrHt6kI3IP0FI/eCIFuklAFDqJikAtccKcEHI9FKP8a/RYSgcSIhiXc eSUA13Y6+wDFy+6wdF62rOh0qP+yQQtkjFtEG1cesQR8v94Gj++sufV81ES0nbnh6kJs Vqzr1jQLgJl3XKvFHJO4sKMc9rlYsvUIlb+6SL/cdtzrJZZ2UgtfFVNL4/KDYKJDfAq8 niBiD9IiWFKIT4rVU34ChJ9swAcbanch5R0Os58R+Qe9MwUMQcLAlCBsI/ovH7yipqeO uaGA== 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=NjHzCk/bJrktpEeXve8l3kEH8NVAmMIU6BGUFk73YtM=; b=fVRwiOlwS9BRRbFSsFzEqg27A0YWo0Tq9FwZiLTjySST24xWnp+BwPbYhNsCafA28K kYf1ntZss9boPLAr2xuOffa4nQROi+MDUUNFcc6n8eqKJcMUn9IswSbYQuF0XV5LV1AU onVYYWE8iuIvPAqAWHlMUXd5OSVB37Aom73IzyEA5MuYiLJgwzBCUnHU1PNCjVLAPwvg bPJK03NzD6WzkeE/wnmaPm3+kMOW0VG0M+GL81+e3oUyZ1P19sJx4tsex9U5oKVgXz8p 908+lYc8qVrQ7Z+KPVGVYjcXZwuXKb5oKTACPDbXjW2Sj1RYo7FYEFHLe4Z+q3lFj4dp imcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d3G4K2ee; 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 h63si15067356pje.79.2019.07.25.00.46.15; Thu, 25 Jul 2019 00:47:06 -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=d3G4K2ee; 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 S2405182AbfGXUAJ (ORCPT + 99 others); Wed, 24 Jul 2019 16:00:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:47914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404425AbfGXUAF (ORCPT ); Wed, 24 Jul 2019 16:00:05 -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 162D8214AF; Wed, 24 Jul 2019 20:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998405; bh=TgKenZT6uu0WJD3ZsqrhoJdgAhGX33wkZumBXr0XTZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d3G4K2eeQdM14kovw6GB96e4UY3SUMR+B27z2NQNDlycM3FrrMRjgXzATolV1KBP4 t0i+2kAP++mLcfIkLG29cUTYjC0/Ttb2m26ozIexxjklIgl2uQbK3Jrfnw+C7z9kMc zAHmmq0piCq4dWo4FFFliocif92CEQiS0qEIkAf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Michael Ellerman Subject: [PATCH 5.1 355/371] powerpc/pseries: Fix oops in hotplug memory notifier Date: Wed, 24 Jul 2019 21:21:47 +0200 Message-Id: <20190724191750.642398704@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@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 @@ -980,6 +980,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;