9p/trans_fd: abort p9_read_work if req status changed
authorDominique Martinet <dominique.martinet@cea.fr>
Tue, 9 Oct 2018 02:18:52 +0000 (11:18 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 09:01:48 +0000 (11:01 +0200)
commite73153efdee7f8dc42df65b4b704b1844396ecd2
treec02fce70be8655400ced07022f15f28220576373
parent7745e3c67b80865bd0bc0812fda9f6292c8dc2fb
9p/trans_fd: abort p9_read_work if req status changed

[ Upstream commit e4ca13f7d075e551dc158df6af18fb412a1dba0a ]

p9_read_work would try to handle an errored req even if it got put to
error state by another thread between the lookup (that worked) and the
time it had been fully read.
The request itself is safe to use because we hold a ref to it from the
lookup (for m->rreq, so it was safe to read into the request data buffer
until this point), but the req_list has been deleted at the same time
status changed, and client_cb already has been called as well, so we
should not do either.

Link: http://lkml.kernel.org/r/1539057956-23741-1-git-send-email-asmadeus@codewreck.org
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Reported-by: syzbot+2222c34dc40b515f30dc@syzkaller.appspotmail.com
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/9p/trans_fd.c