Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3067885ybt; Mon, 29 Jun 2020 14:26:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7nY9g17bwyrW5H9p7TiNakVDEhgzDnvIEbeM2inLxbIBfC8Sonyy/0mxTVHEJlEbx5aAn X-Received: by 2002:a17:906:c459:: with SMTP id ck25mr16542097ejb.177.1593465987067; Mon, 29 Jun 2020 14:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593465987; cv=none; d=google.com; s=arc-20160816; b=s+rgj7QWUUti5lDZr81Ev582XlrIwXtldSFSc6oarZcS5jOhXN1OtzGpPFWGVlvdlD xB+qYL2ZAbCgxK+I3Wmlnz6YUrj3nhPBH3yoTzirL3BuFq9fTff2n31Zrt6j+tmUU+Wn 1nPA12trBae9osZ9wJH2vgNNuPqPNItKywlc5Wv+WXfK3sMUff+aG0aMZymGUy8qnoeT JwMwAj9NHMBjxwuafaN1QgvbH/pTX9kk8uXOWCKydNk8t0kfSxhqSsV6tHa42VY4R4j/ +qFpIr+BB8XjT9SfZPEDEFhB0agNQh65Szb+2vyHwWgUpQvNxbdFFp5bSQAx3EBjpqLQ lZyw== 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=eONiPl/yCRDuMa4wVG6xM1L316NQ8wNv8h/nW3q4S6c=; b=K4nJWFvAYz5++DBdjDVlRacOW374LfF4yPwB98mT8gRSxMmnOjnnPAKTWr3jpZzs1Y 4qSJjR38/ZPHuPtKkMsYSmlZHTj8fNmHLYk9eBCalp5mbT9t9Js4AloFNM0Tnpva0kfA SNG9bt2cTaDocvXrHM0MsJ2fI2lpH0tjIZfMZ0oPZSo2LfX/YRZchJrjTdcYmiU9KfFX HQFeSZyp+TxImSGh4AB8MUWTYcxdWlGlmL+/11nAWiASndQc5SC+VH7vjJTkGDy6g2o5 47D2T8RFJWmWyWhVKc3RbRvkVv1Yxry9/rVBIFkPfl5+BYzN8Npy3IBy0n4/k5NqWYZ8 CMlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zekE3DSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si418966ejd.687.2020.06.29.14.26.04; Mon, 29 Jun 2020 14:26:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zekE3DSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390762AbgF2VYi (ORCPT + 99 others); Mon, 29 Jun 2020 17:24:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:38876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729487AbgF2SuP (ORCPT ); Mon, 29 Jun 2020 14:50:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 17DCE25374; Mon, 29 Jun 2020 16:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593447622; bh=VU/RIJXvCYk+2jviH8h2AT1vE98UnjDulLXhUfcDuQM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zekE3DSOLBcqpTnJqEY1MWbVu31fmkX0WoQ29NElsbLZeg5a1/ebgLKulJEaGDcAJ Ves1NgwfqAndZuwwUlg6t38RoVYM0obP7iONb6svovbBOH2Kbd4jrJutTSZDHnzYnS Vwek86TKKmK6noATwJONwfVYpkK0BrWm9HoXoR3s= Date: Mon, 29 Jun 2020 18:20:13 +0200 From: Greg KH To: Andra Paraschiv Cc: linux-kernel@vger.kernel.org, Anthony Liguori , Benjamin Herrenschmidt , Colm MacCarthaigh , Bjoern Doebel , David Woodhouse , Frank van der Linden , Alexander Graf , Martin Pohlack , Matt Wilson , Paolo Bonzini , Balbir Singh , Stefano Garzarella , Stefan Hajnoczi , Stewart Smith , Uwe Dannowski , kvm@vger.kernel.org, ne-devel-upstream@amazon.com Subject: Re: [PATCH v4 07/18] nitro_enclaves: Init misc device providing the ioctl interface Message-ID: <20200629162013.GA718066@kroah.com> References: <20200622200329.52996-1-andraprs@amazon.com> <20200622200329.52996-8-andraprs@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200622200329.52996-8-andraprs@amazon.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 11:03:18PM +0300, Andra Paraschiv wrote: > +static int __init ne_init(void) > +{ > + struct pci_dev *pdev = pci_get_device(PCI_VENDOR_ID_AMAZON, > + PCI_DEVICE_ID_NE, NULL); > + int rc = -EINVAL; > + > + if (!pdev) > + return -ENODEV; Ick, that's a _very_ old-school way of binding to a pci device. Please just be a "real" pci driver and your probe function will be called if your hardware is present (or when it shows up.) To do it this way prevents your driver from being auto-loaded for when your hardware is seen in the system, as well as lots of other things. > + > + if (!zalloc_cpumask_var(&ne_cpu_pool.avail, GFP_KERNEL)) > + return -ENOMEM; > + > + mutex_init(&ne_cpu_pool.mutex); > + > + rc = pci_register_driver(&ne_pci_driver); Nice, you did it right here, but why the above crazy test? > + if (rc < 0) { > + dev_err(&pdev->dev, > + "Error in pci register driver [rc=%d]\n", rc); > + > + goto free_cpumask; > + } > + > + return 0; You leaked a reference on that pci device, didn't you? Not good :( thanks, greg k-h