Skip to content
  • Jerome Marchand's avatar
    staging: zram: fix zram locking · 0900beae
    Jerome Marchand authored
    
    
    Currently init_lock only prevents concurrent execution of zram_init_device()
    and zram_reset_device() but not zram_make_request() nor sysfs store functions.
    
    This patch changes init_lock into a rw_semaphore. A write lock is taken by
    init, reset and store functions, a read lock is taken by zram_make_request().
    Also, avoids to release the lock before calling __zram_reset_device() for
    cleaning after a failed init, thus preventing any concurrent task to see an
    inconsistent state of zram.
    
    Signed-off-by: default avatarJerome Marchand <jmarchan@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    0900beae