From 03bb6dd02ef3cbc4e4c0bbc03fb38d15a0166bd5 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Fri, 30 Aug 2013 12:18:27 +0200 Subject: [PATCH] PFS: remember request information for IOCTLs Not doing so caused PFS to commit protocol violations by relying on stale information when sending replies. This stale information always happened to be correct, which is why the problem went unnoticed. Change-Id: Ia42ca670718d6e731193cd2c34a3ff455f8a94d3 --- servers/pfs/dev_uds.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/servers/pfs/dev_uds.c b/servers/pfs/dev_uds.c index 3937235d3..a12f8ac32 100644 --- a/servers/pfs/dev_uds.c +++ b/servers/pfs/dev_uds.c @@ -152,7 +152,7 @@ int uds_open(message *dev_m_in, message *dev_m_out) uds_fd_table[minor].suspended = UDS_NOT_SUSPENDED; /* and the socket doesn't have an I/O grant initially */ - uds_fd_table[minor].io_gr = (cp_grant_id_t) 0; + uds_fd_table[minor].io_gr = GRANT_INVALID; /* since there is no I/O grant it effectively has no size either */ uds_fd_table[minor].io_gr_size = 0; @@ -813,6 +813,13 @@ int uds_ioctl(message *dev_m_in, message *dev_m_out) /* update the owner endpoint - yes it's really stored in POSITION */ uds_fd_table[minor].owner = dev_m_in->POSITION; + /* update the process endpoint, which may well be different */ + uds_fd_table[minor].endpoint = dev_m_in->USER_ENDPT; + + /* save I/O Grant info */ + uds_fd_table[minor].io_gr = (cp_grant_id_t) dev_m_in->IO_GRANT; + uds_fd_table[minor].io_gr_size = 0; /* should not be used here */ + switch (dev_m_in->COUNT) { /* Handle the ioctl(2) command */ case NWIOSUDSCONN: