From patchwork Wed Jan 9 10:56:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 155062 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp562740jaa; Wed, 9 Jan 2019 02:56:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN7FdFSmpZzDe/u7T/w0ZVV3aR3qLpGkbDNaimUFxoIMlZmiERzXHKMx3MZv8yknGATErmzo X-Received: by 2002:a63:f109:: with SMTP id f9mr4888361pgi.286.1547031407427; Wed, 09 Jan 2019 02:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547031407; cv=none; d=google.com; s=arc-20160816; b=AUk0h4JN23CVdxoHZbGGD9tVgNf7LvUlUUOPxkpZOJ3O6fQFjbWoBVs+Rq5cEuPWc5 l1T1WlidsMXImimzwWM6jznRJjVRSwql17m2DzybmzTPQykwsptkDFsl7wguyG2FlRPE wGyLO2H+78rHukfDXQJeko+Lld/9iinUrazpOl35NasI1GHWRFwi+ddSWKVELA0aVFZu q+E/9dDFIiV8ks3LR03M+9Rjb6FgwDxd+sz1tS/10VE8csC4ibN11Pjvve40KaR2R8iY tR0cU/CpcDseZ5nMERLqa1gQGi86Qf20xrrXW1ciggXPbmQ65euwfH9zXv9UdA8SLSCl +odg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=CHxRmrNyG0l2PdyLq/vtV610LqFBYPE+0iswOovzKH4=; b=hyOw3EzECA2/tDC1LzlSMzlqn9o8etXaBfb5ZL0G1IirGGSYEVXO6VomyyCIEc8wA8 WQh8XTFIf1BmkWFxYww0aKHWOaBHKmGWfzRyk902NlpPY32A5lpwCL+RRA7DPMqf4gj6 j7dnBXGJx0X7jQCf55FvrIE2GWUGjWKwHNHJAuQt6joHhvkKbvo/oi5FIYYIcX8FjyxK LFHnJeK+KpkSt37DzE5hVEy5VggCKSf4r2jL+eNn9Xqb+RxLGby4Sbk8Arfdzp3GR41F YQspDY69IYaIuUOhcPble21Kr7grL/7MYtlE423/0CeIpXieznHMA+P9kWFkBEkbFENr ZPOQ== ARC-Authentication-Results: i=1; mx.google.com; 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 f189si241333pfg.123.2019.01.09.02.56.47; Wed, 09 Jan 2019 02:56:47 -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; 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 S1730446AbfAIK4p (ORCPT + 31 others); Wed, 9 Jan 2019 05:56:45 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:18692 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729752AbfAIK4p (ORCPT ); Wed, 9 Jan 2019 05:56:45 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x09AuXCu015374; Wed, 9 Jan 2019 11:56:40 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2ptwtdkd8a-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 09 Jan 2019 11:56:40 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B27C134; Wed, 9 Jan 2019 10:56:39 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 890A027EF; Wed, 9 Jan 2019 10:56:39 +0000 (GMT) Received: from SAFEX1HUBCAS21.st.com (10.75.90.45) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 9 Jan 2019 11:56:38 +0100 Received: from localhost (10.201.20.178) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 9 Jan 2019 11:56:38 +0100 From: Loic Pallardy To: , CC: , , , , , , Loic Pallardy Subject: [PATCH 1/1] remoteproc: fix recovery procedure Date: Wed, 9 Jan 2019 11:56:43 +0100 Message-ID: <1547031403-34535-1-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.201.20.178] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-09_06:, , signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 7e83cab824a87e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()") replaces rproc_{shutdown,boot}() with rproc_{stop,start}(), which skips destroy the virtio device at stop but re-initializes it again at start. Issue is that struct virtio_dev is not correctly reinitialized like done at initial allocation thanks to kzalloc() and kobject is considered as already initialized by kernel. That is due to the fact struct virtio_dev is allocated and released at vdev resource handling level managed and virtio device is registered and unregistered at rproc subdevices level. This patch initializes struct virtio_dev to 0 before using it and registering it. Fixes: 7e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()") Reported-by: Xiang Xiao Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_virtio.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 183fc42a510a..88eade99395c 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -332,6 +332,8 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) struct virtio_device *vdev = &rvdev->vdev; int ret; + /* Reset vdev struct as you don't know how it has been previously used */ + memset(vdev, 0, sizeof(struct virtio_device)); vdev->id.device = id, vdev->config = &rproc_virtio_config_ops, vdev->dev.parent = dev;