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=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham 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 84062C10F0E for ; Mon, 15 Apr 2019 18:48:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4675C2087C for ; Mon, 15 Apr 2019 18:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354108; bh=o8WU5jJq6idQa815QjFa58x4Kc0UhZGgcns4woUtyNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ALH7nOO1t/dOvWwONwGs8hotmJdtyC2WkiYVwqFIylI81xhI1Emf0BxDGo/CtjX72 lTeivLGK2zEqUJkRFCWBkNoLE2U//s7AXVsl6kDK4VktUd2veBVZt+wOTILnnIdW3O 82FJGrzALr27usCHgZ3JWISQeVhPpvY7l9kof65E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728140AbfDOSs1 (ORCPT ); Mon, 15 Apr 2019 14:48:27 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;