From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1892FC4363A for ; Tue, 27 Oct 2020 07:52:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4EB82224E for ; Tue, 27 Oct 2020 07:52:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="fOqq+19m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731218AbgJ0HwU (ORCPT ); Tue, 27 Oct 2020 03:52:20 -0400 Received: from casper.infradead.org ([90.155.50.34]:33814 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729371AbgJ0HwT (ORCPT ); Tue, 27 Oct 2020 03:52:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QpSn6rVmBADq+LVc5dj6aNDyf3z8Z/Up4qmHSS7sdMI=; b=fOqq+19m6ngxDbZjFNqTu3mfpi cy7dlsYgekZqZwtjptm+G/wCLLIdZ9ldm/nXZjM/5aLDMLgbNdVlIh3Ps/LuQYnT/qrl9XWJuTW3k nMXJPZx/yxaRAXftni8G/d/wOBAHblh5AzenfCjUUZBTbBoUkowsBrfw/Uh8iqDodGXxVrEvsDWPE 43wEiPQM0JX3J3sXBJsm5/KvOaFhW9y8yNDnyklSfpBP5IY2GJTSctdrE8SkNPkvCiVnAGm9kSjb7 TNdFcaLkYl4MsZZmEi1Jqw8T77Svm6oqiqv6yMYYZyK8F0iTwDJi7i7asgpOfdqA30GAlWJG642mS Yq6iSuAg==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXJmD-00083C-UD; Tue, 27 Oct 2020 07:52:17 +0000 Date: Tue, 27 Oct 2020 07:52:17 +0000 From: Christoph Hellwig To: Zhenzhong Duan Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, bhelgaas@google.com, hch@infradead.org Subject: Re: [PATCH v2] PCI: check also dynamic IDs for duplicate in new_id_store() Message-ID: <20201027075217.GA30879@infradead.org> References: <20201026035710.593-1-zhenzhong.duan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026035710.593-1-zhenzhong.duan@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Mon, Oct 26, 2020 at 11:57:10AM +0800, Zhenzhong Duan wrote: > When a device ID data is writen to /sys/bus/pci/drivers/.../new_id, > only static ID table is checked for duplicate and multiple dynamic ID > entries of same kind are allowed to exist in a dynamic linked list. > > Fix it by calling pci_match_device() which checks both dynamic and static > IDs. > > After fix, it shows below result which is expected. > > echo "1af4:1000" > /sys/bus/pci/drivers/vfio-pci/new_id > echo "1af4:1000" > /sys/bus/pci/drivers/vfio-pci/new_id > -bash: echo: write error: File exists > > Drop the static specifier and add a prototype to avoid build error. > > Signed-off-by: Zhenzhong Duan Looks good, Reviewed-by: Christoph Hellwig