Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp67916yba; Fri, 3 May 2019 20:54:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWgZZD8AHTp8UyDw5uR7gkK1aFS+txqvOFfX6A/IXhf0pwOpiS0WdUOu0uiyca5HeglbpU X-Received: by 2002:a65:4183:: with SMTP id a3mr15412002pgq.121.1556942078772; Fri, 03 May 2019 20:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556942078; cv=none; d=google.com; s=arc-20160816; b=WBqrow6pUvSJI3daDvRGvqairvfrzqYU6lfz0PgfcKhIGfQVAsQaE9izQPIaiqIgn6 aeIGdfGtF50hKOOnYUkw/TOqgMgfpWBmBSa6Zei+6dmPRCZs3srYsDD/4CQDkpXb0jNe PJDw0CHRyDrjgI3nuVcFu5H20UOflSMruVRbGLkze6o7u+qZo/wXHlIZdMmzxsO1PLls 0PlXwcOquPRaE10yuadcks/yUgQBJ9PVy58IMO819OoUrBAcHFFUKfwOXLyJj1hQLMon LmZnnY5PytGCYZZk32vKe6a/ppaGOnLcIV2HT1pINpLXBa1WUdnRliwHhRXEFwp79RsO 7sZA== 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 :references:in-reply-to:from:subject:cc:to:message-id:date; bh=8o82k1vLFH2ylcMLhO2jufNyFH4ZpOz6N5AcrBS+RIM=; b=WuCdMIWpJchqVD+3y6gx03L8fQqKl7yKmyK2mHqDUGBjV9T//EkhHxqBLjapm8zrMg 2hFAQahKciAC+ob9xzNEhbYTnDPZdHj/5EpTjh0ZMo6acl9JEWsk4AJYFBeAxABpkg1L 2tF5LKQGWLXW+nCX526Ld1Qei1SjfPkgzD/utU2fj5mcwT/uizaXKfJE3AC+ufbXglO4 l0t6WLzgYzFMwh7EByEM28QfJiEwANJWYdQi0t7bPzmjUVFXhGCphOU1C4yUZeyFspL4 imRgKf0H32J4E3X3lMrD2OnqH8DeOz26ls2Y6P8WPi6qu2vjXLdV2bApW4Hh8vazSMPE ebDw== 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 f67si5700160pfb.36.2019.05.03.20.54.09; Fri, 03 May 2019 20:54:38 -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 S1726898AbfEDDlk (ORCPT + 99 others); Fri, 3 May 2019 23:41:40 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:55438 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbfEDDlk (ORCPT ); Fri, 3 May 2019 23:41:40 -0400 Received: from localhost (unknown [75.104.87.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 4EF3B14D68898; Fri, 3 May 2019 20:41:35 -0700 (PDT) Date: Fri, 03 May 2019 23:41:31 -0400 (EDT) Message-Id: <20190503.234131.1909607319842703379.davem@davemloft.net> To: baijiaju1990@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: via-rhine: net: Fix a resource leak in rhine_init() From: David Miller In-Reply-To: References: <20190504030813.17684-1-baijiaju1990@gmail.com> <20190503.231308.1440125282445011089.davem@davemloft.net> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 03 May 2019 20:41:40 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai Date: Sat, 4 May 2019 11:23:06 +0800 > > > On 2019/5/4 11:13, David Miller wrote: >> From: Jia-Ju Bai >> Date: Sat, 4 May 2019 11:08:13 +0800 >> >>> When platform_driver_register() fails, pci_unregister_driver() is not >>> called to release the resource allocated by pci_register_driver(). >>> >>> To fix this bug, error handling code for platform_driver_register() >>> and >>> pci_register_driver() is separately implemented. >>> >>> This bug is found by a runtime fuzzing tool named FIZZER written by >>> us. >>> >>> Signed-off-by: Jia-Ju Bai >> I think the idea here is that PCI is not enabled in the kernel, it is >> fine for the pci register to fail and only the platform register to >> succeed. >> >> You are breaking that. > > Okay, I can understand it. > If so, I think that platform_driver_register() should be called before > pci_register_driver(), and it is still necessary to separately handle > their errors. > If you agree, I will send a v2 patch. It is only a failure if both fail. If at least one succeeds, the driver can potentially probe properly.