From: David van Moolenbroek Date: Fri, 30 Aug 2013 10:18:27 +0000 (+0200) Subject: PFS: remember request information for IOCTLs X-Git-Tag: v3.3.0~612 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/verify-sign/tz-link.htm?a=commitdiff_plain;h=784cdd4d072a73706f6c5332d82180cfdd1c2c5b;p=minix.git 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 --- 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: