Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2448209yba; Mon, 15 Apr 2019 11:51:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrWaTgHGbfWqYWeSskd1bGtFIB560hG4RGK+Q7b4EaCFrtPwQRjgUvbnzweNw2QcAEQ9wO X-Received: by 2002:a65:500d:: with SMTP id f13mr72543374pgo.250.1555354275709; Mon, 15 Apr 2019 11:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555354275; cv=none; d=google.com; s=arc-20160816; b=okVFtAPRjhwq5pN5oJ8AzghOx89J5vvjo4PCo5Qg/f+QqIBOgRIYKWiw6Wn6nI36im TWrMb0j53tlxp6RMgtCl3n+puSiogDZAf4xgU7btyoLHlKGoC6+ts2wX4jIGWX8B3mXk CD3Gfyk/dH5LFDWOW7RdX8yRXzzG+FLqJCiNm/p2d09313GZA71lWZZ1J7+mdrxPOk4D Z4dwp06vWcF/l2T0OQntAfhdWv/EJlgqsEMteMXlGtvbr/bA0zvGm5RHFRZxDdGr8km6 N//wdS7yZcIbF51F9txJN6mN7O0cn/2riYE7bExqGvfY5IgUdZpAZLyrI0TtTUXoJ02b 0L2Q== 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=pSJjNZSj+PW7vNoBeuQEp0CK3K7m/dsdpqtRBhyPHRo=; b=fCe3sDUOJt1IYfInlOg3EnZ4tp9Ci1iqAbcyDqn4GyZ/ydDYDEGmrxCJF0ubrjv61y DJxM4IFz4pvSce18uUykUriUo/jFPeJrAA6z7IGH2sDXzgsI58fWKXTZhJ4kySQk7Sjs 1G9i9ibL/iP8XYJXly038HH7xxRFYkQ3lsngAV2q72nm+eresXtw1+p7woRe7m54O64P X0yLFw5Mn9JhtNeRQ6IbNaqEsJtn4aL0vcOOkhHS1BNWw5oOKdwXn+g896NDaMDmkJ5E xAA/g6gNBSSfQZM8ZXvyb2V231Wz/AJXxATRiEfJdj/yT6Az+svq7DLme08qF8jq0bpW EweQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OIpVOtyQ; 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 j9si32511772plk.125.2019.04.15.11.50.59; Mon, 15 Apr 2019 11:51:15 -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=OIpVOtyQ; 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 S1729117AbfDOSs2 (ORCPT + 99 others); Mon, 15 Apr 2019 14:48:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:51958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbfDOSsK (ORCPT ); Mon, 15 Apr 2019 14:48: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 921ED218EA; Mon, 15 Apr 2019 18:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354090; bh=o8WU5jJq6idQa815QjFa58x4Kc0UhZGgcns4woUtyNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIpVOtyQZI7W2g0pye8Me+v3C282RhrQxOjtktWZS3/TRQY1fYY5LCiZSfAzfyCLw qjnifCCFP1c9Y+TjOo8rpFkMT2q+33Ac/KtbuFWTL/Cl9C4IPHAkxjilD2sK0+WKNR h1JRF5alDSVnTtT0RyehC8fymN1op5UkEpOVH/CQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov Subject: [PATCH 4.9 75/76] xtensa: fix return_address Date: Mon, 15 Apr 2019 20:44:39 +0200 Message-Id: <20190415183729.593436709@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183707.712011689@linuxfoundation.org> References: <20190415183707.712011689@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: Max Filippov commit ada770b1e74a77fff2d5f539bf6c42c25f4784db upstream. return_address returns the address that is one level higher in the call stack than requested in its argument, because level 0 corresponds to its caller's return address. Use requested level as the number of stack frames to skip. This fixes the address reported by might_sleep and friends. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov Signed-off-by: Greg Kroah-Hartman --- arch/xtensa/kernel/stacktrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/arch/xtensa/kernel/stacktrace.c +++ b/arch/xtensa/kernel/stacktrace.c @@ -272,10 +272,14 @@ static int return_address_cb(struct stac return 1; } +/* + * level == 0 is for the return address from the caller of this function, + * not from this function itself. + */ unsigned long return_address(unsigned level) { struct return_addr_data r = { - .skip = level + 1, + .skip = level, }; walk_stackframe(stack_pointer(NULL), return_address_cb, &r); return r.addr;