vfs: read file_handle only once in handle_to_path
authorSasha Levin <sasha.levin () oracle ! com>
Wed, 28 Jan 2015 11:30:43 +0000 (20:30 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Wed, 15 Apr 2015 05:59:05 +0000 (14:59 +0900)
commit92ccb5b4e1c4da8a08d4976e6fa10998f1910286
tree1e31726e069d0de0799e32a874a4fd56dbee5a39
parent9785bd3ebd4ea3b14b7ebff7d6b9e2a1c19e250d
vfs: read file_handle only once in handle_to_path

This patch was related with "[CVE-2015-1420] Race condition in fs/fhandle.c in the Linux kernel".

We used to read file_handle twice. Once to get the amount of extra bytes, and
once to fetch the entire structure.

This may be problematic since we do size verifications only after the first
read, so if the number of extra bytes changes in userspace between the first
and second calls, we'll have an incoherent view of file_handle.

Instead, read the constant size once, and copy that over to the final
structure without having to re-read it again.

Change-Id: I318d7428079e323f53bc7eb1f7dc0a5dfac7eb0b
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Byungsoo Kim <bs1770.kim@samsung.com>
Signed-off-by: sungmin ha <sungmin82.ha@samsung.com>
fs/fhandle.c