9p/trans_fd: avoid sending req to a cancelled conn
authorSishuai Gong <sishuai.system@gmail.com>
Tue, 8 Aug 2023 16:44:31 +0000 (12:44 -0400)
committerDominique Martinet <asmadeus@codewreck.org>
Tue, 24 Oct 2023 04:52:37 +0000 (13:52 +0900)
commit58e3ce767307130e911408c75f054d6a6673c8a3
tree62025555aaeea9eb2b9e2725a5e7f08e9d2198d5
parent05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1
9p/trans_fd: avoid sending req to a cancelled conn

When a connection is cancelled by p9_conn_cancel(), all requests on it
should be cancelled---mark req->status as REQ_STATUS_ERROR. However,
because a race over m->err between p9_conn_cancel() and p9_fd_request(),
p9_fd_request might see the old value of m->err, think that the connection
is NOT cancelled, and then add new requests to this cancelled connection.

Fixing this issue by lock-protecting the check on m->err.

Signed-off-by: Sishuai Gong <sishuai.system@gmail.com>
Message-ID: <AA2DB53B-DFC7-4B88-9515-E4C9AFA6435D@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
net/9p/trans_fd.c