Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2474268yba; Mon, 15 Apr 2019 12:23:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxE9wL9zK3kj4Exm2kyuMsIQpZeZrbP4AiPrYhhHyayRsIP2X+4NoLq1JhOloNnAkHntfQE X-Received: by 2002:a63:e20b:: with SMTP id q11mr73380509pgh.263.1555356231419; Mon, 15 Apr 2019 12:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555356231; cv=none; d=google.com; s=arc-20160816; b=R0chb1DkxNG66a83WvtufUeBfCjOfKys/i3DGeHlDa0IuPZVgXk77aF8hI81qhhrdN GqQXcmvTAFw50NcBJJeuJoHHSMLVI6O52mvsT96/PBMVi9rUO2s7XDyhXRHwKFzcFvwF UWkHy1ocR30FB/QPHyg1OYroRBMXT74fqgWF9KtDmSA573XZTL3xyb2hdx7As8phpSWL TRcH61DWP7qoYIdgJtcPsN4LkLmKf4KxgS8kgU2itmlavhf5r9Z8YtdomfcXmXXhkxzO 0dVM2m434pP7TfqsqxaYeFsaYUGvU4gu9d/n4DGFDdQyI2tFiYCt9g7T11GdTIlP7+e8 HFow== 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=bE760H7kSb88b6qRrt6P7Xmb24IikvEZS/VWiFtz1gyfzPBv4qlkmtBlhj/WtEBI8B Qxzd6rKSMAuYwWqrzLQRxnRXVrHZfC/SEZbNx67KtIMsHVC6JeuoA7FG0Hgh3Yf90igm AfwYPd2DUB3mVEEWGJPCdzXfFuJEL0S0mBi/V2ZTQTLLVgnyJoAH5nhGmbMFL4RM8oI4 xPYIMz58jVTPXUWYCOW9JKiUIxCMwj4hHPgtPHzTBjoKFhDMujRLJ2CWqP4qg3aTtElU /hZGpWgV4AtJY8/lXuf1nNVuEKb9kJpklTWNPCALla4IW1aQR9VhCC1BHbRpk2yil41J mm6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xwQc0Oe3; 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 t24si31837772pgu.597.2019.04.15.12.23.35; Mon, 15 Apr 2019 12:23:51 -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=xwQc0Oe3; 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 S1729451AbfDOTIT (ORCPT + 99 others); Mon, 15 Apr 2019 15:08:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:43626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730419AbfDOTIR (ORCPT ); Mon, 15 Apr 2019 15:08:17 -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 B2FF420880; Mon, 15 Apr 2019 19:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355297; bh=lV/5N/A/xAKHQrs+2JzZ2IFh2g1IBhWls9baD+cI1ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xwQc0Oe3OVaCruwuBn1lXAOd78klimX1LDecXFmL+zLkB8kpC9bw2hR8biShfm0cz 5pY2RmYWCkbEl0v2kX2oMRw3wy8ltseIW7BFaCU+rTBOAFMQXiYsuAHn8ySI/1zRwe fjWRu+VXw68YWJG6IJy5+3/1/k2G2MW7t1KCz3z0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov Subject: [PATCH 4.19 085/101] xtensa: fix return_address Date: Mon, 15 Apr 2019 20:59:23 +0200 Message-Id: <20190415183744.896787544@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@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;