Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1055511pxx; Tue, 27 Oct 2020 07:17:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHKiL0YrQGaDlVJjzNYRBGcJaZcsVy9JDU9ra14jSPaRjEuOY909qvz6krnv+LqR/kUPN6 X-Received: by 2002:a50:85c6:: with SMTP id q6mr2570736edh.126.1603808220664; Tue, 27 Oct 2020 07:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603808220; cv=none; d=google.com; s=arc-20160816; b=ceLV8JdBybsFoUH/Q81PgpUsWHBKba3jZYUOsWzpVLelKVAatTXtzvSk7GikQ6tqdC US5WmGk8a+WBpMhYof9DQ/tyPGp1hvLDRuZEbydgMWHw9xDEULAnNdMnN3t0B+E6mKpA DEYMOxW9EsmV6apKh9nEGMUc/2PG0ZlbubDAFg8pDOQPqS7fRAjHqFdMXQskauJDNIj5 zPa9Ilx0V/lc9zVMLDki9G7kJ7x81kN3fsEhQPTO+gRPNkqUtr+qA9SzbAwtH+xfFK1x L4FqJa3GxGe7VVWQnvZiRml8tvpTMEB4+WSmVqhvruDyjI5yEoNpAo9hAC2YBBUkE7GM iDhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QpSn6rVmBADq+LVc5dj6aNDyf3z8Z/Up4qmHSS7sdMI=; b=eS7tAM6hulIOnp1CTYAA77ZC/xQe5cCMT3RCbE63rbUZ+FQm0hNDiqqWLkZgWl5NyG SR7j1p1EzY+JZ3FBQnjfOoWISDIraCSmi7LGxqQaWimGbLKutrivIhb8QZlyOZ9Q39Oy 9GYK/1Ha9UsNO/aEQ69xBOOhZxLVyPXsrxrqye7C92AfMhy7OBNZYNi7umMaC9k1AAI7 k8PT3pcj30dQ8HqqQzn0u/+vRr/yqR6YLsicDUJwgy9eTZOZkwy7Lvtgi+GPy9ht+4iD F+K+922t+NdKgxEFgmzdlALBc4PAsE23iOezgLrix2X8oZ2QVUw3ekt6M4mV+6Yhrlpa YWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=fOqq+19m; 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 ga36si1024363ejc.37.2020.10.27.07.16.38; Tue, 27 Oct 2020 07:17:00 -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=@infradead.org header.s=casper.20170209 header.b=fOqq+19m; 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 S2507391AbgJ0HwU (ORCPT + 99 others); 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-kernel@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