Staging: zram: Fix memory leak by refcount mismatch
authorRashika Kheria <rashika.kheria@gmail.com>
Sun, 10 Nov 2013 16:43:53 +0000 (22:13 +0530)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:47:16 +0000 (11:47 +0900)
commitbb47a2d8071321710af6b666af78b1d92a97886e
treee00813452491150497a856868fd9606b65451bff
parente3b99bb05c2da9c8d19212482a20b95297ca7278
Staging: zram: Fix memory leak by refcount mismatch

As suggested by Minchan Kim and Jerome Marchand "The code in reset_store
get the block device (bdget_disk()) but it does not put it (bdput()) when
it's done using it. The usage count is therefore incremented but never
decremented."

This patch also puts bdput() for all error cases.

Change-Id: I92198df5ff42242ef3627e5d3db4acece7940d61
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/zram/zram_drv.c