From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF722182C8 for ; Tue, 25 Jul 2023 11:29:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42757C433C7; Tue, 25 Jul 2023 11:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690284595; bh=GNiqWt66TGECbDuvVHmAQu5Y4ctvGg8u57XrZLdjqlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYlMe6z6WBxb5tzuCqCd7N8OlW81VdpH7bHQWQWtkyx64GEq0eqEn/ld4zT8ieEGL QWnbFQkDO6oOKPcis/ijp4p1VUbVeuATgf0f9PaAgiyyMQ6Sh9GXdnAhmnH2Be6Zr/ ukXm2xVOKRX6zFP3xxuSvOvDONbqGzM0YiDicLHM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Damien Le Moal , Lorenzo Pieralisi , Bjorn Helgaas , Manivannan Sadhasivam Subject: [PATCH 5.10 405/509] misc: pci_endpoint_test: Re-init completion for every test Date: Tue, 25 Jul 2023 12:45:44 +0200 Message-ID: <20230725104612.275236600@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104553.588743331@linuxfoundation.org> References: <20230725104553.588743331@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Damien Le Moal commit fb620ae73b70c2f57b9d3e911fc24c024ba2324f upstream. The irq_raised completion used to detect the end of a test case is initialized when the test device is probed, but never reinitialized again before a test case. As a result, the irq_raised completion synchronization is effective only for the first ioctl test case executed. Any subsequent call to wait_for_completion() by another ioctl() call will immediately return, potentially too early, leading to false positive failures. Fix this by reinitializing the irq_raised completion before starting a new ioctl() test command. Link: https://lore.kernel.org/r/20230415023542.77601-16-dlemoal@kernel.org Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device") Signed-off-by: Damien Le Moal Signed-off-by: Lorenzo Pieralisi Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/pci_endpoint_test.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -727,6 +727,10 @@ static long pci_endpoint_test_ioctl(stru struct pci_dev *pdev = test->pdev; mutex_lock(&test->mutex); + + reinit_completion(&test->irq_raised); + test->last_irq = -ENODATA; + switch (cmd) { case PCITEST_BAR: bar = arg;