mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
2a011abc47
When the OpenAFS client is unmounted on DARWIN, the blocks of packets allocated by RX are released. Historically, the memory used by those packets was never properly released. Before 230dcebcd61064cc9aab6d20d34ff866a5c575ea, only the last block of packets used to be released: ... struct rx_packet *rx_mallocedP = 0; ... void rxi_MorePackets(int apackets) { ... getme = apackets * sizeof(struct rx_packet); p = rx_mallocedP = (struct rx_packet *)osi_Alloc(getme); ... } ... void rxi_FreeAllPackets(void) { ... osi_Free(rx_mallocedP, ...); ... } ... As we can see, ‘rx_mallocedP’ is a global pointer that stores the first address of the last allocated block of packets. As a result, when ‘rxi_FreeAllPackets’ is called, only the last block is released. However, 230dcebcd61064cc9aab6d20d34ff866a5c575ea moved the global pointer in question to the end of the last block. As a result, when the OpenAFS client is unmounted on DARWIN, the ‘rxi_FreeAllPackets’ function releases the wrong block of memory. This problem was exposed on OS X 10.12 Sierra where the system crashes when the OpenAFS client is unmounted. To fix this problem, store the address of every single block of packets in a queue and release one by one when the OpenAFS client is unmounted. Reviewed-on: https://gerrit.openafs.org/12427 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> (cherry picked from commit 5b28061fb593f5f48df549b07f0ccd848348b93c) Change-Id: Id8606b1c1444861df69ed4af8169e343964a691d Reviewed-on: https://gerrit.openafs.org/12602 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>