Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2227394ybl; Sat, 11 Jan 2020 12:02:39 -0800 (PST) X-Google-Smtp-Source: APXvYqz57PHCc6HGdYgbdiBhc9LwG/Z6XV+AlX4osyjvYRXlWbS5cgGmM9JweaT7PWiV4x71iRX/ X-Received: by 2002:a9d:c42:: with SMTP id 60mr7497802otr.182.1578772959403; Sat, 11 Jan 2020 12:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578772959; cv=none; d=google.com; s=arc-20160816; b=KvxWI+g1PXdQofEa+4JpO2f6WgMu0nzs/Wy79NbKuW12egi2eueRSGopf8ZDJnSP/a Yvxz20UGxka6Rue5/530C4v/yw5jhVDcosAXJEHNRJQDF9dXGaMF3KQglY2x6f2ppQwd 9jrpxlyJKUbaMu5GyNf4xil6NJ7yiIwsuJA4ySJ2DTElkUnpl4C8h0FiHm3+ebMXtjoa lX1KqktgiKkP2o5dVtMthxF1wJ2aEWh5zfcnwz/N2EP24gybB9mPUteL/naIKfCdB2xZ 6oMlKID3lOtmMR4ojsbvt3ikysWDO+F6WpydifX/FXp2qcQdLmcYmAoYj1MenQq/c5RK /SNA== 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=ydhQuyCeD41sq5PIrucF67UIeqWHW11WTBK9m6KUMTk=; b=nbqvo+lMp/DEM1lEI6gnYKAwnNqV2zTWwTAoisWaRt4d0AaT+gCSVa/oaXIeYvuvPJ CDwVxaqDX58bMne1wXmExnDULjiOVNGA9Q0KoUW31KPbMkTAmELy1zWqzb9h5JVN6kA8 6PbD8MlRUIK4EGfPWb+hrSiYOVQ5d6X3XS0DeqaMfZujG0ImG89p5EVWJOCfbcTkmVLe k7XN1zG2+taSoqPRPKRoDaZ9XbgqbfY0VE5HgiD2X9ODdz61eY5M8OMjdbftIO7Hk3AC AXHQHeaWwg5PGWQfmdmPv3K6CF2RVT9oXiBBIZJxWt/T30jKmCqh4SnMW+TNg0au+Aav ferg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S9eCIiQm; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 92si4097132otr.25.2020.01.11.12.02.16; Sat, 11 Jan 2020 12:02:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=@kernel.org header.s=default header.b=S9eCIiQm; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731085AbgAKUCD (ORCPT + 99 others); Sat, 11 Jan 2020 15:02:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:55860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731083AbgAKUCD (ORCPT ); Sat, 11 Jan 2020 15:02:03 -0500 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3066A20866; Sat, 11 Jan 2020 20:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578772922; bh=4bxlJS8vU/MMH+Ybyi3LMPzmFH6dAF8uh/1PGTdl3xA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S9eCIiQmHgrpL7kJjjR0uW8UKxu9gv1wYz0w8LRH6KFUekcDJf56aMKwU1jPaU3x3 YuK6X5QP/6MiL3LOSO8uSOf5djvapdHtKotypUbvoPY8c1xKgmrCuuSd2I2WMrCDxV tia3Y7mfUL6e33emaKXl/gAS4XhRzh32P3AhDuKs= Date: Sat, 11 Jan 2020 20:40:06 +0100 From: Greg Kroah-Hartman To: Zhangfei Gao Cc: Arnd Bergmann , Herbert Xu , jonathan.cameron@huawei.com, dave.jiang@intel.com, grant.likely@arm.com, jean-philippe , Jerome Glisse , ilias.apalodimas@linaro.org, francois.ozog@linaro.org, kenneth-lee-2012@foxmail.com, Wangzhou , "haojian . zhuang" , guodong.xu@linaro.org, linux-accelerators@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, iommu@lists.linux-foundation.org, Kenneth Lee , Zaibo Xu Subject: Re: [PATCH v11 2/4] uacce: add uacce driver Message-ID: <20200111194006.GD435222@kroah.com> References: <1578710919-12141-1-git-send-email-zhangfei.gao@linaro.org> <1578710919-12141-3-git-send-email-zhangfei.gao@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1578710919-12141-3-git-send-email-zhangfei.gao@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Sat, Jan 11, 2020 at 10:48:37AM +0800, Zhangfei Gao wrote: > +static int uacce_fops_open(struct inode *inode, struct file *filep) > +{ > + struct uacce_mm *uacce_mm = NULL; > + struct uacce_device *uacce; > + struct uacce_queue *q; > + int ret = 0; > + > + uacce = xa_load(&uacce_xa, iminor(inode)); > + if (!uacce) > + return -ENODEV; > + > + if (!try_module_get(uacce->parent->driver->owner)) > + return -ENODEV; Why are you trying to grab the module reference of the parent device? Why is that needed and what is that going to help with here? This shouldn't be needed as the module reference of the owner of the fileops for this module is incremented, and the "parent" module depends on this module, so how could it be unloaded without this code being unloaded? Yes, if you build this code into the kernel and the "parent" driver is a module, then you will not have a reference, but when you remove that parent driver the device will be removed as it has to be unregistered before that parent driver can be removed from the system, right? Or what am I missing here? > +static void uacce_release(struct device *dev) > +{ > + struct uacce_device *uacce = to_uacce_device(dev); > + > + kfree(uacce); > + uacce = NULL; That line didn't do anything :) thanks, greg k-h