fs: Fix theoretical division by 0 in super_cache_scan().
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Sat, 17 May 2014 11:56:38 +0000 (20:56 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 16:59:46 +0000 (08:59 -0800)
commit3fd35793ac58c8d2f578f62a867b274d50490791
tree7f619d9687f57b88c0eb608a608352861bd3dc00
parent9c5f9dcad8be822dd4ebe7f9640b0c8af2c57122
fs: Fix theoretical division by 0 in super_cache_scan().

commit 475d0db742e3755c6b267f48577ff7cbb7dfda0d upstream.

total_objects could be 0 and is used as a denom.

While total_objects is a "long", total_objects == 0 unlikely happens for
3.12 and later kernels because 32-bit architectures would not be able to
hold (1 << 32) objects. However, total_objects == 0 may happen for kernels
between 3.1 and 3.11 because total_objects in prune_super() was an "int"
and (e.g.) x86_64 architecture might be able to hold (1 << 32) objects.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/super.c