Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2477475yba; Mon, 15 Apr 2019 12:28:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKpWoBoa2xPa8fdvQc8ZJOJpa3hsnHT7OuubRA6FFj7F1qTQQutxs34GlPseBvhqiE0ZeR X-Received: by 2002:a62:52c3:: with SMTP id g186mr77724125pfb.173.1555356492137; Mon, 15 Apr 2019 12:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555356492; cv=none; d=google.com; s=arc-20160816; b=Ld4jjyYM16XhuSaS7u7OeAhSo/OMK18GbsX4nXOx7H2ez9McuF80Kt1yVHFbrpi2nn D4a8za1IZj01ALc7MNijnsrDt6ZdpezWgTnMcT7ST2WJ6NmSu8cyh1Iie8eUk7CyerAf 3kv8rNDPh76YLiQ689o8MRuxGhlIInO0HLr+7dWfrf3sf5eaibs0IPt4eNeKYbTez1uR 7JYCjvixt7TRNtcCCj0MAI0NxN3MpoEgg5Wl3I99Wx0zVvmUGmfHL/EqfYpP34fP0pZN 3y2ePCITUzPjU/jaGOQE8xQcPczJlWacfi6WpDYjoayUgi4fxSewU8L3z0YGhw0GMRRD xjpQ== 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=2VreLEqUXtweAlxiJ176I+ceRAc9dQiIb4jQfZi0ISc=; b=cyL458UnRAcWGDGnUlFiBmmTjp5swrtZ15mU7Uio2QM/Qlq/PMpZzKjIDmYN4m+1Et AaIlgEWRXXJKqQKJ4oeDKgtbqe28AFwILC4zXf3RlJ2aFR1GItRl4vWov6yZQwpplXbg 0/oCzYQmUzLTAKL1BqqLOh6KujVk4EwXnlOJVFcaxyhPntsWCSAeuz0C8NGbH4uT2xrX jeTU3pbHw2sdvbdn0MfPRb8l9y251p5tp8/sLOstoxtGUHsfjVk5BJ35X83271IEyj1/ yxsx0Zyc3dH38SYDRJ4fTggg0kWSDfzCiXmvDAQ9csmND9l2eBTZOuaiPLxIJ15Wwf5D dWeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cq4aF3z6; 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 q23si45444870pgk.140.2019.04.15.12.27.56; Mon, 15 Apr 2019 12:28:12 -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=cq4aF3z6; 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 S1729868AbfDOT0l (ORCPT + 99 others); Mon, 15 Apr 2019 15:26:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729557AbfDOTEc (ORCPT ); Mon, 15 Apr 2019 15:04:32 -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 B19B9218A1; Mon, 15 Apr 2019 19:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355072; bh=lV/5N/A/xAKHQrs+2JzZ2IFh2g1IBhWls9baD+cI1ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cq4aF3z60qNyTl/++DookMS4G+1NayG3eogGNDJHJ1de7VyUN+yZ6vCDIk4uds46L /huNCq2mCmmf1rklIPM68nT+VeefVs+mfmHhTy4MhVyFb/pvLZBo9w+jsDnlldX/W3 GSBxkiMCTZAIUcBk0rxeinwKezbumhpnoGqjFgaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov Subject: [PATCH 4.14 62/69] xtensa: fix return_address Date: Mon, 15 Apr 2019 20:59:20 +0200 Message-Id: <20190415183735.698315344@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@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 @@ -253,10 +253,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;