]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:27 +0000 (14:22 -0300)
commit650689170108a4f5e985ee102974291b28c4be95
treefef162e200c22fa7c49195b97674a1bec2081dab
parent571f8c6912d51266c1d9428797f711e5f752b5cf
kernfs: fix ino wrap-around detection

BugLink: https://bugs.launchpad.net/bugs/1857158
commit e23f568aa63f64cd6b355094224cc9356c0f696b upstream.

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: 4a3ef68acacf ("kernfs: implement i_generation")
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: stable@vger.kernel.org # v4.14+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/kernfs/dir.c
include/linux/kernfs.h