Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp629890imu; Wed, 9 Jan 2019 03:50:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Adnwsn35/4RMPByaFdv87A14pTXs8uz1NkARmivlCcmn2AofcHifmsVLP7CGSLqXr62Up X-Received: by 2002:a63:fa06:: with SMTP id y6mr5095143pgh.177.1547034631160; Wed, 09 Jan 2019 03:50:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547034631; cv=none; d=google.com; s=arc-20160816; b=KxM7OQ56HVFCOLEWF4lwp96O9DIcDudDaetWmljlMfd0gR5cQ1i7Z3anmW0ski8NJM D6eJyl9U6GUC0Q1o/fhPDG3eqeTbQCTzPPraPvNxwJ9fBD5ibpOEkw8LlY9vNzp6ay+G X/Dk50hKwa9VthVOWpPW48R8sSirYKZyzwrwAdnvz1wjPIaOLzRpghUuBeoDXjsxjRPE RCc3NY9K73oZl0xy8AeQD3gi+5ulW/B6T4zCjMi9LKtmzTg2I2MgRs981SkQaGHI6BNQ FNygIAcwzPR1BbWHiAQw+zJUMksoqjm+3MKA+NzXdwwLE8ZyClaufHERgn66EDVAgQB5 uVHg== 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 1si16932204plp.114.2019.01.09.03.50.15; Wed, 09 Jan 2019 03:50:31 -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 S1730390AbfAIK4p (ORCPT + 99 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 Content-Type: text/plain 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(+) 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; -- 2.7.4