From patchwork Fri Nov 15 22:33:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 179538 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp13127045ilf; Fri, 15 Nov 2019 14:34:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwqlctjrdr4MgiT3FV450v6Ltm6cRbHcog9/aPDrmxj0Nqq0speY+tV+LiCr9ZojQNW81W+ X-Received: by 2002:a17:906:a989:: with SMTP id jr9mr4355764ejb.160.1573857289653; Fri, 15 Nov 2019 14:34:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573857289; cv=none; d=google.com; s=arc-20160816; b=d+KwJd6Lp2uJ/O5lnuVoZl6+AA7h+r2GFEPwXb5P+i9iV50JOs6aRp8IsNFyeLjl3+ IC7aWrfqA59HH9W8fQGAELMnIJ8RHLGQzl0BdOAl2tbeRw+D7tY/4EAQtp0wQRtQ1UQl FpjlwtZskyL8QS1xpTrhgZfSbZZt6ePE9ai0gkVLaX2CQiIJxLdRO9Idi7A7bEywfIXr 6V0X1kq9BOmtl7v55NMpB8u3OMFxRtXmTe4NRXL47tEftCZAOtoMLytUIP3q0vZtbUOL JzxC+YsSQYnIyIaEdvETocDLnDxDxSAQWstYrg792bxxrtkWCg0E0ZRGPMkZ1Sz5PYpb Pf8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HUM10/8Wh+ACpH8iy+zYVazM7/j5x9SwSLUXvaHdtoE=; b=YvBYn3PiXCtahuVNEDVdmhEEfxoJ7hGpoEFcQSHrFbWqWILBC7Kv51dAUtLdyqyqOD icw18BCDdwEa+MiPSHpunf6da4jJPiymXtUs97ryAsYzpxFysdFNvSgf+ihknTvnd108 gWT+J0Q8LEuJyQ+iFKrBpvgcSwwSiJiclpTsbYxcfl7p6T2+RY2U7s0caP0ShKugJtVP hSdROcpi4Mny0zdbEX1Ywqpm17Olh/hc08A3YqRLx563WQDLQPdXmnfMALDLnYJOk/Ax JbWiNG3d/q2JLgbDcErT+DVlF8Gcq/G5gV3Y9vxibTcpY/YalwEF4+L2HB1UBQumv3jK iPQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ypkIu9Lp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id re9si6820483ejb.332.2019.11.15.14.34.49; Fri, 15 Nov 2019 14:34:49 -0800 (PST) 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=@linaro.org header.s=google header.b=ypkIu9Lp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbfKOWeI (ORCPT + 26 others); Fri, 15 Nov 2019 17:34:08 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43972 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727178AbfKOWeF (ORCPT ); Fri, 15 Nov 2019 17:34:05 -0500 Received: by mail-pl1-f195.google.com with SMTP id a18so5616598plm.10 for ; Fri, 15 Nov 2019 14:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HUM10/8Wh+ACpH8iy+zYVazM7/j5x9SwSLUXvaHdtoE=; b=ypkIu9LpYzuilaTSO1ddkj4eAfzXCWg5IShx48OXs6BvHNF3e7+rx/03wNN1tYaleh SnZM8RHGgSNVrsmiwniMNuQyH174+xgl/q4FEQxe7UVXDuVhTtT/3TIahPM8bt5ZmH3+ ud8Eos51tOebTw0Y0mq1tqIEY0ssGv6FbVUe9ALZXTAWJPcnpmI7iUshmshcvm770Ayk jRwA1AXpceNmz1E6uqRFqcGSLc2lSSfvePTl8s/unV8Lzx+f9sx/TSGf3xflzHr4szxN BXuLl9NHzQ6cEOZbYvbeYcQ1U5te3v0DNBTnZ3Ab2FwTA3bfYQBRlEMA2uNi2PTy8N92 PCxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HUM10/8Wh+ACpH8iy+zYVazM7/j5x9SwSLUXvaHdtoE=; b=FbsaVQwDT5MgW+SH1whWg+ZhCOphNIa9kVvTQIU11YC3qn+Imq/oGryB3zi/VQpWYZ 4ONj1aBZFlVvrOC0M2+nISjhPB6z3b7MYAt7PWTWGmkgh7g2maobB+beUSwHQ+R1SoyY xDz3S43E5xb22srIbCPvicRlAvhwO4Fd1C7giAANPi9UqerQ8Kh/lJqs+B3iprSbJpqJ DRcL6zEPKjxbFACADOhOqCxNdP2uL+l4l2+d1FkJsmRlpH23fVVDGObUsKRwqgc1XzjZ lq9xAu7p9U/yWzzj9ZEm07QDxHfBwuON1jGD0xloKDcrPqC+2IaLXyJyluMgvl7b3ILW wzQg== X-Gm-Message-State: APjAAAVDBX/kT5D5RnyXgfSzg0MdHgICNxmsBFFEE0SqIIpSMQ3WwGX/ Blfik74mOimfHjO3Y05ctVT96h7uBSk= X-Received: by 2002:a17:90a:256f:: with SMTP id j102mr22689164pje.124.1573857244238; Fri, 15 Nov 2019 14:34:04 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id m15sm11699724pfh.19.2019.11.15.14.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 14:34:03 -0800 (PST) From: Mathieu Poirier To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [stable 4.19+][PATCH 08/20] remoteproc: fix rproc_da_to_va in case of unallocated carveout Date: Fri, 15 Nov 2019 15:33:44 -0700 Message-Id: <20191115223356.27675-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115223356.27675-1-mathieu.poirier@linaro.org> References: <20191115223356.27675-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Pallardy commit 74457c40f97a98142bb13153395d304ad3c85cdd upstream With introduction of rproc_alloc_registered_carveouts() which delays carveout allocation just before the start of the remote processor, rproc_da_to_va() could be called before all carveouts are allocated. This patch adds a check in rproc_da_to_va() to return NULL if carveout is not allocated. Fixes: d7c51706d095 ("remoteproc: add alloc ops in rproc_mem_entry struct") Signed-off-by: Loic Pallardy Signed-off-by: Bjorn Andersson Cc: stable # 4.19+ Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index aa6206706fe3..af9d443e7796 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -183,6 +183,10 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, int len) list_for_each_entry(carveout, &rproc->carveouts, node) { int offset = da - carveout->da; + /* Verify that carveout is allocated */ + if (!carveout->va) + continue; + /* try next carveout if da is too small */ if (offset < 0) continue;