make prepend_name() work correctly when called with negative *buflen
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 23 Mar 2014 04:28:40 +0000 (00:28 -0400)
committerJiri Slaby <jslaby@suse.cz>
Thu, 3 Apr 2014 08:32:29 +0000 (10:32 +0200)
commita41fd7536d9cbc81cf02033c3efa4078431fa4d0
tree24c826b660b08f78a65b20ec46b807a26b9f849e
parent2c611dc0ca77c8012fee6f33cf05040b16dbee38
make prepend_name() work correctly when called with negative *buflen

commit e825196d48d2b89a6ec3a8eff280098d2a78207e upstream.

In all callchains leading to prepend_name(), the value left in *buflen
is eventually discarded unused if prepend_name() has returned a negative.
So we are free to do what prepend() does, and subtract from *buflen
*before* checking for underflow (which turns into checking the sign
of subtraction result, of course).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/dcache.c