Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp267073ybv; Thu, 6 Feb 2020 22:38:05 -0800 (PST) X-Google-Smtp-Source: APXvYqw1iuPRk/DDF0kwrxAnIQTM3VFPjcQTn6hdvq6lTOgu1YHnZy65t+fT2RtWEHct6dJrfwsS X-Received: by 2002:aca:4b0f:: with SMTP id y15mr1030712oia.153.1581057485265; Thu, 06 Feb 2020 22:38:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581057485; cv=none; d=google.com; s=arc-20160816; b=Xon6M4y2Tvb4BITicNslwtcfidROs2aT0WqHdZsG71fAhnA2WG+PGkzBFF5jH3kcF4 +NSuymS5AjV62VnYILaV5PIPI84Om85weRnBkDZLsS+zKtsDQyJQqgxyizOwBHGT2a9F ivjPOh/1fhbQspLLhvRVilZtzW2tT3Gcghm74GgoRj8Yph1agrOJCEh87W5UNuzG+psD l+9ZX4v2V/zdtcd3JLTFx7uhn9fiMVJNFKqiXMu2gvHY0nrky4dOz/yO5BbLRI76fuDG 74Wro80MUnKdLh5UTRbJh4CtWLTHZf0ZC3mG3pDPizypdjNtyMXQraPNdsRaZdUkgzJH 2kRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fN1p0YF8w6RVvXxIM+isyAEkTDIBckRLo+TQh36LRrI=; b=srRcB59AGce1rq2+Iq2An6iUPyDOvFYX2mtJzc2ncYRd5032T9LuklKU+35EpmgFgv KHuG4VnlbcBsIHZSlgZ/AXMqDSsikwNL5oz/bkMzt+dALyVQthHHR7GWfzZr0xnSIIJ1 Gw0k7RZ7dbsadt54M2hvc2p8lZn996nx0XsM98kF6IFFF076sl6FxQFYiBVk1uIjvzYA PBw9fJVKthGWNYxQCPLaP/bppHmkV9chxQp1z8SySqx/kgRGrgiulMltj5c9BPu6ZIPi BLAPX/nLE5s8UTReK2TvkQiNTzIVA+CuTMhPmhjjukxT8ZfzSxtcNTZdXuA0//9b9TbB z70w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@maquefel.me header.s=mail header.b="YO/KeKyV"; 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 g25si1344177otj.198.2020.02.06.22.37.52; Thu, 06 Feb 2020 22:38:05 -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=@maquefel.me header.s=mail header.b="YO/KeKyV"; 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 S1726619AbgBGGg5 (ORCPT + 99 others); Fri, 7 Feb 2020 01:36:57 -0500 Received: from forward106p.mail.yandex.net ([77.88.28.109]:47315 "EHLO forward106p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgBGGg4 (ORCPT ); Fri, 7 Feb 2020 01:36:56 -0500 X-Greylist: delayed 450 seconds by postgrey-1.27 at vger.kernel.org; Fri, 07 Feb 2020 01:36:53 EST Received: from forward103q.mail.yandex.net (forward103q.mail.yandex.net [IPv6:2a02:6b8:c0e:50:0:640:b21c:d009]) by forward106p.mail.yandex.net (Yandex) with ESMTP id B618E1C81750; Fri, 7 Feb 2020 09:29:20 +0300 (MSK) Received: from mxback7q.mail.yandex.net (mxback7q.mail.yandex.net [IPv6:2a02:6b8:c0e:41:0:640:cbbf:d618]) by forward103q.mail.yandex.net (Yandex) with ESMTP id B338A61E0002; Fri, 7 Feb 2020 09:29:20 +0300 (MSK) Received: from vla3-5ed9a7202853.qloud-c.yandex.net (vla3-5ed9a7202853.qloud-c.yandex.net [2a02:6b8:c15:341d:0:640:5ed9:a720]) by mxback7q.mail.yandex.net (mxback/Yandex) with ESMTP id 7l5AJaDdHo-TKLmegL5; Fri, 07 Feb 2020 09:29:20 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1581056960; bh=fN1p0YF8w6RVvXxIM+isyAEkTDIBckRLo+TQh36LRrI=; h=In-Reply-To:Subject:Cc:To:From:References:Date:Message-ID; b=YO/KeKyVnPRnxd7vGuzRPl6tKyBDPaQ7IR5SlqlT+cGpVDnQkro006sZEAIDOxbya DKuFljblh30XcwPFKmEe9FGMFnRaIRBBEG6jgfkpRDJG0ecAiDq+gj83LepcS/dRAD h9N2QzwJI1dF894VoJ7M5YtG8eXI6tKVgIoyFF0k= Authentication-Results: mxback7q.mail.yandex.net; dkim=pass header.i=@maquefel.me Received: by vla3-5ed9a7202853.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 9kDLtmxjjA-TJVWclLW; Fri, 07 Feb 2020 09:29:19 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Date: Fri, 7 Feb 2020 09:30:15 +0300 From: Nikita Shubin To: Bjorn Andersson Cc: Nikita Shubin , Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] remoteproc: warn on kick missing Message-ID: <20200207063015.GA15993@maquefel.me> References: <20200206055419.15897-1-NShubin@topcon.com> <20200206201827.GP2514@yoga> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200206201827.GP2514@yoga> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 06, 2020 at 12:18:27PM -0800, Bjorn Andersson wrote: > On Wed 05 Feb 21:54 PST 2020, Nikita Shubin wrote: > > > .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. > > > > At least a warning needed on attempt to call missing method. > > Is this not a fatal error only happening during development? In which > case the NULL pointer dereference will come with an oops with sufficient > information to pinpoint what's going on? Hello, Bjorn. This error is happenning if no kick method was defined for struct rproc_ops, like, for example, in imx_rproc. Looks, like if we have a resource table with defined vring's in it, a virtqueue will be allocated in rp_find_vq, passing rproc_virtio_notify. But may be it's a better way to refuse calling vring_new_virtqueue if kick method method is not defined. To avoid explicit load in rproc_virtio_notify. > > Regards, > Bjorn > > > > > Signed-off-by: Nikita Shubin > > --- > > drivers/remoteproc/remoteproc_virtio.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c > > index 8c07cb2ca8ba..77a81f331e3f 100644 > > --- a/drivers/remoteproc/remoteproc_virtio.c > > +++ b/drivers/remoteproc/remoteproc_virtio.c > > @@ -32,6 +32,12 @@ static bool rproc_virtio_notify(struct virtqueue *vq) > > > > dev_dbg(&rproc->dev, "kicking vq index: %d\n", notifyid); > > > > + if (unlikely(rproc->ops->kick == NULL)) { > > + WARN_ONCE(rproc->ops->kick == NULL, ".kick method not defined for %s", > > + rproc->name); > > + return false; > > + } > > + > > rproc->ops->kick(rproc, notifyid); > > return true; > > } > > -- > > 2.24.1 > > > > Confidentiality Notice: This message (including attachments) is a private communication solely for use of the intended recipient(s). If you are not the intended recipient(s) or believe you received this message in error, notify the sender immediately and then delete this message. Any other use, retention, dissemination or copying is prohibited and may be a violation of law, including the Electronic Communication Privacy Act of 1986. ??