Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5565395ybf; Thu, 5 Mar 2020 03:02:38 -0800 (PST) X-Google-Smtp-Source: ADFU+vtaHxUrLTRwRtBkzanLe5qcI9X5AVvCcNIA+bIz6yVa6HZhzRqCC9I7jwLl/VF55KV+whDW X-Received: by 2002:a54:4181:: with SMTP id 1mr5049495oiy.61.1583406158874; Thu, 05 Mar 2020 03:02:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583406158; cv=none; d=google.com; s=arc-20160816; b=C1vxHJrSVm32wrKKDy1rwakJyULpkoPqjHIb0YEJFTI3zHhBunbdKpfWE/rwIfTRrp eX4tZ9X+Iv1JdM/+OTUiqVrMzm0foPxKUNqKQhEIncNiXrUXKB2atJWCeSpbRhv/Z/GE 7P1RX9zgCwiFRfKbrpr7E+OGqXiU5CRSr5qiouRmDLfFrnBqYR0v771c8SEpvdkPC7EW PmqrFWxfIPkNfe6UiG7/erCvW4P2rB5mwTAfBYlq2l1bsfInAOhoY3DwnxXNv53HT/Nb 01xc5fhDHQy0p+NChRZMTlWuSP7ZB3hDqgJWYvzeqbuhq7clpRw1DELaIKmpoH3zIsm8 ibyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=/kV4O0qJVZXzwid6BVH7MX/fCuvUiaSY86OITvWYn1A=; b=bAHY9FMmdz3FNuNP2OhJZh7OL9SnQjvVuG5vLoqomE5TaG/9RGKrK9Xd2MTBWeNFGq G6c78S3GjVJymdGhZknUDiAQWEE4xNsLpXOqyyVWiY74CJ5u/LANl7DOK/j9HKyIq1IL AvDkinaStRLUB/T8SAk8ERIKpDB8J8HcjNEoGrSc9B7YaFMNOeuGeGn4AC/wn4XQxx9/ iaQHwSLaDp1RrLPi5H41L7o5qjTp+fzXltE3I+a6IfljqQpiQ5R8cnewjIwqgYf7IAzD kUT9dC7a6NXC4NyDI6VEj73HvhCsjEaRMRkfrsspEfR4bu+Juk16hGgAIzuV4dCidRPv eh2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@maquefel.me header.s=mail header.b=TamgzMfW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=topcon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z26si3028452oid.247.2020.03.05.03.02.26; Thu, 05 Mar 2020 03:02:38 -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=fail header.i=@maquefel.me header.s=mail header.b=TamgzMfW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=topcon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgCELBf (ORCPT + 99 others); Thu, 5 Mar 2020 06:01:35 -0500 Received: from forward104j.mail.yandex.net ([5.45.198.247]:43097 "EHLO forward104j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725903AbgCELBf (ORCPT ); Thu, 5 Mar 2020 06:01:35 -0500 Received: from forward100q.mail.yandex.net (forward100q.mail.yandex.net [IPv6:2a02:6b8:c0e:4b:0:640:4012:bb97]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 446E84A1583; Thu, 5 Mar 2020 14:01:33 +0300 (MSK) Received: from mxback8q.mail.yandex.net (mxback8q.mail.yandex.net [IPv6:2a02:6b8:c0e:42:0:640:b38f:32ec]) by forward100q.mail.yandex.net (Yandex) with ESMTP id 417987080006; Thu, 5 Mar 2020 14:01:33 +0300 (MSK) Received: from vla5-445dc1c4c112.qloud-c.yandex.net (vla5-445dc1c4c112.qloud-c.yandex.net [2a02:6b8:c18:3609:0:640:445d:c1c4]) by mxback8q.mail.yandex.net (mxback/Yandex) with ESMTP id JCH9oiAXUo-1XNSk0sb; Thu, 05 Mar 2020 14:01:33 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1583406093; bh=/kV4O0qJVZXzwid6BVH7MX/fCuvUiaSY86OITvWYn1A=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=TamgzMfWAMa1KOXUnp4dwwC7MfAGwuARc/H+dgdt2VxkKtxHM8Txz/F/TYVMTCLdN 3SIZPRmzTt8uV+d4wUVEJx6vap6/n5uFUsIS2vmXIDNDA2sIN/flWQuf8+/xm8Wzah ButFPaNGxfu7PjNP2KBAzxPttBnasQcqSu8pa2kk= Authentication-Results: mxback8q.mail.yandex.net; dkim=pass header.i=@maquefel.me Received: by vla5-445dc1c4c112.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8hWJyQQZRL-1WW8nAin; Thu, 05 Mar 2020 14:01:32 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Nikita Shubin Cc: Nikita Shubin , stable@vger.kernel.org, Ohad Ben-Cohen , Bjorn Andersson , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/1] remoteproc: Fix NULL pointer dereference in rproc_virtio_notify Date: Thu, 5 Mar 2020 14:02:18 +0300 Message-Id: <20200305110218.8799-2-NShubin@topcon.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200305110218.8799-1-NShubin@topcon.com> References: <20200228110804.25822-1-nikita.shubin@maquefel.me> <20200305110218.8799-1-NShubin@topcon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org .kick method not set in rproc_ops will result in: 8<--- cut here --- Unable to handle kernel NULL pointer dereference in rproc_virtio_notify, after firmware loading. refuse to register an rproc-induced virtio device if no kick method was defined for rproc. Signed-off-by: Nikita Shubin Fixes: 7a186941626d19f668b08108db158379b32e6e02 ("remoteproc: remove the single rpmsg vdev limitation") Cc: stable@vger.kernel.org --- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 8c07cb2ca8ba..31a62a0b470e 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) struct rproc_mem_entry *mem; int ret; + if (rproc->ops->kick == NULL) { + ret = -EINVAL; + dev_err(dev, ".kick method not defined for %s", + rproc->name); + goto out; + } + /* Try to find dedicated vdev buffer carveout */ mem = rproc_find_carveout_by_name(rproc, "vdev%dbuffer", rvdev->index); if (mem) { -- 2.24.1