]> www.infradead.org Git - users/jedix/linux-maple.git/commit
9p/net: fix improper handling of bogus negative read/write replies
authorDominique Martinet <asmadeus@codewreck.org>
Wed, 19 Mar 2025 11:20:15 +0000 (20:20 +0900)
committerDominique Martinet <asmadeus@codewreck.org>
Wed, 19 Mar 2025 12:19:59 +0000 (21:19 +0900)
commitd0259a856afca31d699b706ed5e2adf11086c73b
tree13d61a66605818ccf7cf2ac8493fa461f32e9940
parent3f61ac7c65bdb26accb52f9db66313597e759821
9p/net: fix improper handling of bogus negative read/write replies

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>
net/9p/client.c