diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2022-11-17 19:21:01 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-11-21 13:49:58 +0300 |
commit | d9e8da558580513318a36f4ecb1b6e28e41b4de0 (patch) | |
tree | 01e475fcfa3404623721c67d1b6c64c71e3b1996 | |
parent | 148b1da88605bd8e357fa3f8f4d5e3a8eccff3c5 (diff) | |
download | linux-d9e8da558580513318a36f4ecb1b6e28e41b4de0.tar.xz |
NFC: nci: Extend virtual NCI deinit test
Extend the test to check the scenario when NCI core tries to send data
to already closed device to ensure that nothing bad happens.
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Bongsu Jeon <bongsu.jeon@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | tools/testing/selftests/nci/nci_dev.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c index 162c41e9bcae..1562aa7d60b0 100644 --- a/tools/testing/selftests/nci/nci_dev.c +++ b/tools/testing/selftests/nci/nci_dev.c @@ -888,6 +888,17 @@ TEST_F(NCI, deinit) &msg); ASSERT_EQ(rc, 0); EXPECT_EQ(get_dev_enable_state(&msg), 0); + + /* Test that operations that normally send packets to the driver + * don't cause issues when the device is already closed. + * Note: the send of NFC_CMD_DEV_UP itself still succeeds it's just + * that the device won't actually be up. + */ + close(self->virtual_nci_fd); + self->virtual_nci_fd = -1; + rc = send_cmd_with_idx(self->sd, self->fid, self->pid, + NFC_CMD_DEV_UP, self->dev_idex); + EXPECT_EQ(rc, 0); } TEST_HARNESS_MAIN |