Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp548631imm; Wed, 8 Aug 2018 01:17:05 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw6I/FScRXCMhCrtdOjo9dmT4omBeL5gwUsK9fyaoRRUIIpWomJCOIrySlqkKiUHQaFu6P0 X-Received: by 2002:a63:2647:: with SMTP id m68-v6mr1588918pgm.60.1533716225106; Wed, 08 Aug 2018 01:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533716225; cv=none; d=google.com; s=arc-20160816; b=Lg2g++A8jd1DHJ7sR+ndR6Gq2IySnxjaeSWB6m/qtjdJEjmdpt47zSRYxNPccyBIdz RTCpQ+QEk2362rWH9T/d8NpECOrvEicz129s9HRaePV39x1D1Jma2yIldXtHbUs64fWS mSIanhQg/3e36DUeQfBKqp186wnXiGCpS9ihZ/fXeSgc74iWdm2kbfjvjzYCJdCN5FUx j2eL83P6+N9vlhiDB4IhHaSrtcplEMYJ8Cnjtlf/gjazNGwjBQLRhpIApeXNp0TDjqxK uVR2g7/LVXg0ZlSkCanRSvqNaoFttFVFfoECAmYJUWOCZMlD5/LWc+7Cvy4fl0ul3+IC jIrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:date:message-id:subject:from:cc:to :arc-authentication-results; bh=YUP2uc9jsA2tLOZvnJsdyCLiiOEDvhPxw0JmP/C4178=; b=DaCgrSed6gfLw2Yfj179Pvs5BIbKB9OMnSXXgPOrTEQOmFZVYUnWNjPWLXa1Q9eJ9U 0V9hKXrfR30Q8+MazN00jWYQfmjJuodSkXP3kXA1cFCGLWl5tx7hXKKBHDu9YHZ1ogKv AxkIGnH+uUvlx9wN9/rNr+maDQwuRSoLsnxPghEJP1rVnR5E9h1gzCNRBcv2he++abGQ E3EtF8m6164QGUY2M1KndXMyk3gH1xa020VWVR/RFxvBfjRyOc768ObqFt90sC1dePw4 AwncM8Ebg8tZ9rA6Zfm9ErK3GupyEVyGjbntTWpeScTT8aHHFIOWFoq+Mt5uhLjXxV0M i5Lg== 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 f62-v6si3528772pfg.165.2018.08.08.01.16.49; Wed, 08 Aug 2018 01:17:05 -0700 (PDT) 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 S1727156AbeHHKd1 (ORCPT + 99 others); Wed, 8 Aug 2018 06:33:27 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10643 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726979AbeHHKd1 (ORCPT ); Wed, 8 Aug 2018 06:33:27 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D48472BD272E0; Wed, 8 Aug 2018 16:14:49 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtp.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.399.0; Wed, 8 Aug 2018 16:14:47 +0800 To: Dominique Martinet CC: "akpm@linux-foundation.org" , "Eric Van Hensbergen" , Ron Minnich , "Latchesar Ionkov" , Greg Kurz , "Linux Kernel Mailing List" , From: piaojun Subject: [PATCH] net/9p/trans_virtio.c: decrease the refcount of 9p virtio device when removing it Message-ID: <5B6AA65E.3030907@huawei.com> Date: Wed, 8 Aug 2018 16:14:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.253.249] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I found that 9pnet_virtio.ko could not be removed by rmmod command, and I could still found it by lsmod. The reason is that we forgot decrease the refcount of 9p virtio device by kobject_put. So we should put refcount in p9_virtio_remove. Signed-off-by: Jun Piao --- net/9p/trans_virtio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 46a5ab2..a00e992 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -710,7 +710,8 @@ static void p9_virtio_remove(struct virtio_device *vdev) vdev->config->del_vqs(vdev); sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); - kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE); + kobject_uevent(&(vdev->dev.kobj), KOBJ_REMOVE); + kobject_put(&(vdev->dev.kobj)); kfree(chan->tag); kfree(chan->vc_wq); kfree(chan); --