Files
Dominique Martinet a68768e280 9p/net: fix improper handling of bogus negative read/write replies
[ Upstream commit d0259a856afca31d699b706ed5e2adf11086c73b ]

In p9_client_write() and p9_client_read_once(), if the server
incorrectly replies with success but a negative write/read count then we
would consider written (negative) <= rsize (positive) because both
variables were signed.

Make variables unsigned to avoid this problem.

The reproducer linked below now fails with the following error instead
of a null pointer deref:
9pnet: bogus RWRITE count (4294967295 > 3)

Reported-by: Robert Morris <rtm@mit.edu>
Closes: https://lore.kernel.org/16271.1734448631@26-5-164.dynamic.csail.mit.edu
Message-ID: <20250319-9p_unsigned_rw-v3-1-71327f1503d0@codewreck.org>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-05-02 07:50:56 +02:00
..
2021-11-04 21:04:25 +09:00
2023-05-04 21:46:57 +01:00
2022-01-10 10:00:09 +09:00
2022-10-05 07:05:41 +09:00
2021-11-03 17:45:04 +09:00
2024-12-09 10:32:57 +01:00