Whamcloud - gitweb
LU-4619 llite: prevent buffer overflow in fiemap 08/10408/2
authorBobi Jam <bobijam.xu@intel.com>
Fri, 18 Apr 2014 05:58:36 +0000 (13:58 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 27 May 2014 15:43:51 +0000 (15:43 +0000)
commitbcd368431a4d34362f3a3b22727e2ff5a2b85d84
tree4f2c6535ce02f1df244b7a69439bc7209ad46eb9
parent83ec1108525955e9486573ae74d0c656e68bf97d
LU-4619 llite: prevent buffer overflow in fiemap

lov_fiemap() does not take consider its @vallen parameter, which is
the max buffer size the caller can hold for the fiemap extents.

This patch fixes this and limits the max mapped fiemap extent count
to fit in the preallocted buffer.

This patch also fixes a memory out of bound write issue when the
fiemap call is only for detecting the number of existing extent.

Lustre-commit: 19326174e264802b91fb4dfc0c1ea16d8bf3ef7e
Lustre-change: http://review.whamcloud.com/9834

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Change-Id: Ia5aadfa38c3a3d12cdb6e0773ebffb6e213a9abf
Reviewed-on: http://review.whamcloud.com/10408
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/lov/lov_obd.c