[PATCH net-next v1 7/7] ncdevmem: add test for too many token_count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add test for fixed issue: user passing a token with a very large
token_count. Expect an error in this case.

Signed-off-by: Mina Almasry <almasrymina@xxxxxxxxxx>
---
 tools/testing/selftests/net/ncdevmem.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c
index 64d6805381c5..3fd2aee461f3 100644
--- a/tools/testing/selftests/net/ncdevmem.c
+++ b/tools/testing/selftests/net/ncdevmem.c
@@ -391,6 +391,17 @@ int do_server(void)
 				continue;
 			}
 
+			token.token_start = dmabuf_cmsg->frag_token;
+			token.token_count = 8192;
+
+			ret = setsockopt(client_fd, SOL_SOCKET,
+					 SO_DEVMEM_DONTNEED, &token,
+					 sizeof(token));
+			if (ret >= 0)
+				error(1, 0,
+				      "DONTNEED of too many frags should have failed. ret=%ld\n",
+				      ret);
+
 			token.token_start = dmabuf_cmsg->frag_token;
 			token.token_count = 1;
 
-- 
2.47.0.163.g1226f6d8fa-goog





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux