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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 6ACDAC433DF for ; Mon, 15 Jun 2020 15:03:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4374B2063A for ; Mon, 15 Jun 2020 15:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592233436; bh=cEcK51K5rOUEiSEhE1682fXR2DP3KAV9ATdlaabtESw=; h=Subject:To:Cc:From:Date:List-ID:From; b=2Y9P0BeSedqZuS8x+92clpNOpEP6lp9NuejIx8V8blzmd8AKxBVbw1y4sm5Tzk1y/ se1Z3JE0inLbnwOinhOBjILOR5SlP83AqRzBkgpRC//kEWG8Kqj1wY+lxSMC/fed1P zMlvP9ukx4hDn6HHLj7NARA3cEnjjS8NDbgKBHGY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730777AbgFOPDz (ORCPT ); Mon, 15 Jun 2020 11:03:55 -0400 Received: from forward2-smtp.messagingengine.com ([66.111.4.226]:56963 "EHLO forward2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730665AbgFOPDw (ORCPT ); Mon, 15 Jun 2020 11:03:52 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id B0D8B194007D; Mon, 15 Jun 2020 11:03:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 15 Jun 2020 11:03:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Ws+0cC 0pF7ldqUsV8lPY2miY4OdDtkA1DwHHglQ2qbs=; b=sR7JKURnsUmL5zWR7Wvw3T Hc9SEf89vWwjDDG4px1oemwtr+fmnNAPOEiL+gm/uED6Zs26YdimVIqtUH1p3RU7 clnddm411W+RI1hqXZYDUUUGxbFzUDA1N9mdCHyvonUq4B/Bo+ln60HUh4/xgOpe 02HYTaM7GPCUHVQwRBO8SFe9SdVuwsBKjYcLWJv5F/vsDMSs023KD6TcY4OCraAs Qj/OWsuN6rPLkVKGXIUFV21DK6y2EnP04UqU7R0uNrKO3LwcTRgu5FK7K9Tgh9fI VJEDK7oxP2CdyQseVdWyAwAiqwZcT5ZotBoeMNyGSKhEp/i/watCnsuztafClXfg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeikedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepieetveehuedvhfdtgfdvieeiheehfeelveevheejud etveeuveeludejjefgteehnecukfhppeekfedrkeeirdekledruddtjeenucevlhhushht vghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhh drtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 4935D3060FE7; Mon, 15 Jun 2020 11:03:51 -0400 (EDT) Subject: FAILED: patch "[PATCH] firmware: imx: scu: Fix corruption of header" failed to apply to 5.7-stable tree To: franck.lenormand@nxp.com, aisheng.dong@nxp.com, leonard.crestez@nxp.com, shawnguo@kernel.org Cc: From: Date: Mon, 15 Jun 2020 17:03:30 +0200 Message-ID: <15922334107128@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.7-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From f5f27b79eab80de0287c243a22169e4876b08d5e Mon Sep 17 00:00:00 2001 From: Franck LENORMAND Date: Thu, 26 Mar 2020 00:00:05 +0200 Subject: [PATCH] firmware: imx: scu: Fix corruption of header The header of the message to send can be changed if the response is longer than the request: - 1st word, the header is sent - the remaining words of the message are sent - the response is received asynchronously during the execution of the loop, changing the size field in the header - the for loop test the termination condition using the corrupted header It is the case for the API build_info which has just a header as request but 3 words in response. This issue is fixed storing the header locally instead of using a pointer on it. Fixes: edbee095fafb (firmware: imx: add SCU firmware driver support) Signed-off-by: Franck LENORMAND Reviewed-by: Leonard Crestez Signed-off-by: Leonard Crestez Cc: stable@vger.kernel.org Reviewed-by: Dong Aisheng Signed-off-by: Shawn Guo diff --git a/drivers/firmware/imx/imx-scu.c b/drivers/firmware/imx/imx-scu.c index e94a5585b698..b3da2e193ad2 100644 --- a/drivers/firmware/imx/imx-scu.c +++ b/drivers/firmware/imx/imx-scu.c @@ -158,7 +158,7 @@ static void imx_scu_rx_callback(struct mbox_client *c, void *msg) static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg) { - struct imx_sc_rpc_msg *hdr = msg; + struct imx_sc_rpc_msg hdr = *(struct imx_sc_rpc_msg *)msg; struct imx_sc_chan *sc_chan; u32 *data = msg; int ret; @@ -166,13 +166,13 @@ static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg) int i; /* Check size */ - if (hdr->size > IMX_SC_RPC_MAX_MSG) + if (hdr.size > IMX_SC_RPC_MAX_MSG) return -EINVAL; - dev_dbg(sc_ipc->dev, "RPC SVC %u FUNC %u SIZE %u\n", hdr->svc, - hdr->func, hdr->size); + dev_dbg(sc_ipc->dev, "RPC SVC %u FUNC %u SIZE %u\n", hdr.svc, + hdr.func, hdr.size); - size = sc_ipc->fast_ipc ? 1 : hdr->size; + size = sc_ipc->fast_ipc ? 1 : hdr.size; for (i = 0; i < size; i++) { sc_chan = &sc_ipc->chans[i % 4];