From: Jerome Marchand Date: Fri, 10 Jun 2011 13:28:49 +0000 (+0200) Subject: Staging: zram: Replace mutex lock by a R/W semaphore X-Git-Tag: v3.1-rc1~232^2~249 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5bde2388e5b77b39db1b615e2deda2c535f6f60;p=pandora-kernel.git Staging: zram: Replace mutex lock by a R/W semaphore Currently, nothing protects zram table from concurrent access. For instance, ZRAM_UNCOMPRESSED bit can be cleared by zram_free_page() called from a concurrent write between the time ZRAM_UNCOMPRESSED has been set and the time it is tested to unmap KM_USER0 in zram_bvec_write(). This ultimately leads to kernel panic. Also, a read request can occurs when the page has been freed by a running write request and before it has been updated, leading to zero filled block being incorrectly read and "Read before write" error message. This patch replace the current mutex by a rw_semaphore. It extends the protection to zram table (currently, only compression buffers are protected) and read requests (currently, only write requests are protected). Signed-off-by: Jerome Marchand Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed