aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-09-02 10:23:14 (GMT)
committerJouni Malinen <j@w1.fi>2010-09-05 14:35:02 (GMT)
commit5681e8476afbd38eebdb744c2c61a89d20835a83 (patch)
treeae602d60861d1107f6e7514b96fd86d284013592
parent78d386db91f7c0b47ff91b8f11c1578c145635b7 (diff)
downloadhostap-07-5681e8476afbd38eebdb744c2c61a89d20835a83.zip
hostap-07-5681e8476afbd38eebdb744c2c61a89d20835a83.tar.gz
hostap-07-5681e8476afbd38eebdb744c2c61a89d20835a83.tar.bz2
l2_packet_ndis: Fix overlapped write not to corrupt stack
When using overlapped write, we must have the provided memory areas available during the operation and cannot just use stack unless we wait for the completion within the function. In the case of TX here, we can easily wait for the completion since it is likely to happen immediately. In addition, this provides more reliable success/failure return value for l2_packet_send(). [Bug 328] (cherry picked from commit f4e5fd948a43f1889774aa3a6920ded90bb678ea)
-rw-r--r--src/l2_packet/l2_packet_ndis.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/l2_packet/l2_packet_ndis.c b/src/l2_packet/l2_packet_ndis.c
index 7de5880..6ce29aa 100644
--- a/src/l2_packet/l2_packet_ndis.c
+++ b/src/l2_packet/l2_packet_ndis.c
@@ -137,11 +137,17 @@ int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
DWORD err = GetLastError();
#ifndef _WIN32_WCE
if (err == ERROR_IO_PENDING) {
- /* For now, just assume that the packet will be sent in
- * time before the next write happens. This could be
- * cleaned up at some point to actually wait for
- * completion before starting new writes.
- */
+ wpa_printf(MSG_DEBUG, "L2(NDISUIO): Wait for pending "
+ "write to complete");
+ res = GetOverlappedResult(
+ driver_ndis_get_ndisuio_handle(), &overlapped,
+ &written, TRUE);
+ if (!res) {
+ wpa_printf(MSG_DEBUG, "L2(NDISUIO): "
+ "GetOverlappedResult failed: %d",
+ (int) GetLastError());
+ return -1;
+ }
return 0;
}
#endif /* _WIN32_WCE */