Whamcloud - gitweb
LU-4619 llite: prevent buffer overflow in fiemap 34/9834/5
authorBobi Jam <bobijam.xu@intel.com>
Fri, 18 Apr 2014 05:58:36 +0000 (13:58 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 20 Apr 2014 03:31:21 +0000 (03:31 +0000)
commit19326174e264802b91fb4dfc0c1ea16d8bf3ef7e
tree01310ebeac49cf4ac2b33998cf2282fe541f2849
parent26457eac6bebda83893a72a2dac6ecc0b28813ed
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.

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