]> git.baikalelectronics.ru Git - kernel.git/commit
kernfs: fix ino wrap-around detection
authorTejun Heo <tj@kernel.org>
Mon, 4 Nov 2019 23:54:29 +0000 (15:54 -0800)
committerTejun Heo <tj@kernel.org>
Tue, 12 Nov 2019 16:18:03 +0000 (08:18 -0800)
commitedc2d4c47a4d90f6f99309d417f2cf7214e586e8
treefdefc12ecadf8a7677cf7230613a33d6e86e98e0
parent8f9c334720901f3449bd910d0bc3479480c90cbf
kernfs: fix ino wrap-around detection

When the 32bit ino wraps around, kernfs increments the generation
number to distinguish reused ino instances.  The wrap-around detection
tests whether the allocated ino is lower than what the cursor but the
cursor is pointing to the next ino to allocate so the condition never
triggers.

Fix it by remembering the last ino and comparing against that.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 4994cb80978c ("kernfs: implement i_generation")
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: stable@vger.kernel.org # v4.14+
fs/kernfs/dir.c
include/linux/kernfs.h