linux/drivers/staging
frank zago 22aadb91c0 staging: lustre: hsm: stack overrun in hai_dump_data_field
The function hai_dump_data_field will do a stack buffer
overrun when cat'ing /sys/fs/lustre/.../hsm/actions if an action has
some data in it.

hai_dump_data_field uses snprintf. But there is no check for
truncation, and the value returned by snprintf is used as-is.  The
coordinator code calls hai_dump_data_field with 12 bytes in the
buffer. The 6th byte of data is printed incompletely to make room for
the terminating NUL. However snprintf still returns 2, so when
hai_dump_data_field writes the final NUL, it does it outside the
reserved buffer, in the 13th byte of the buffer. This stack buffer
overrun hangs my VM.

Fix by checking that there is enough room for the next 2 characters
plus the NUL terminator. Don't print half bytes. Change the format to
02X instead of .2X, which makes more sense.

Signed-off-by: frank zago <fzago@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8171
Reviewed-on: http://review.whamcloud.com/20338
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jean-Baptiste Riaux <riaux.jb@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03 13:01:37 +01:00
..
android staging: android/ion: Use variable names in header 2017-01-16 18:10:26 +01:00
bcm2835-audio staging: bcm2835-audio: fix style problem in vc_vchi_audioserv_defs.h 2017-02-02 13:05:06 +01:00
board staging: board: Remove calls to of_genpd_get_from_provider() 2016-09-13 02:49:33 +02:00
clocking-wizard staging: clocking-wizard: Fix incorrect type of speed grade 2016-10-25 09:54:32 +02:00
comedi staging: comedi: ni_pcimio: Support more PXI cards 2017-01-19 10:49:50 +01:00
dgnc staging: dgnc: update TODO file 2017-01-03 15:34:06 +01:00
emxx_udc staging: emxx_udc: Fix CamelCase variable name 2017-01-03 16:42:22 +01:00
fbtft staging: fbtft: change 'gamma' array to u32 2017-02-03 13:01:36 +01:00
fsl-mc staging: fsl-mc: remove unnecessary info prints from bus driver 2016-12-08 21:00:08 +01:00
fwserial Staging: fwserial: remove unused function fill_unplug_req 2016-10-16 10:25:09 +02:00
gdm724x staging: gdm724x: cleanup long lines to conform to kernel coding style 2017-01-07 17:04:04 +01:00
goldfish
greybus staging: greybus: Remove duplicate include file 2017-02-03 13:01:36 +01:00
gs_fpgaboot Staging: gs_fpgaboot: Use octal permissions '0444' 2016-10-25 09:40:44 +02:00
iio Staging: iio: adc: ad7816: fix symbolic permissions coding style issue 2017-01-28 12:22:07 +00:00
ks7010 staging: ks7010: Fix brace style issue in ks_wlan_net.c 2017-01-16 18:08:57 +01:00
lustre staging: lustre: hsm: stack overrun in hai_dump_data_field 2017-02-03 13:01:37 +01:00
media staging: bcm2835: don't mark 'bcm2835_v4l2_debug' as static 2017-02-02 13:21:51 +01:00
most staging: most: hdm-usb: fix symbolic permissions warning 2017-01-27 09:40:56 +01:00
mt29f_spinand
netlogic Staging: netlogic: Compress return logic into one line 2016-10-16 10:27:33 +02:00
nvec staging: nvec: fix indent issue in nvec_power.c 2017-01-03 15:22:30 +01:00
octeon staging: octeon: Call SET_NETDEV_DEV() 2017-01-03 17:11:50 +01:00
octeon-usb staging: octeon-usb: Remove unnecessary assignment 2016-09-22 11:54:48 +02:00
olpc_dcon staging: olpc_dcon: olpc_dcon_xo_1_5: Remove multiple blank lines. 2017-01-10 17:40:15 +01:00
rtl8188eu staging: rtl8188eu: remove not necessary braces {} (checkpatch fix) 2017-02-03 13:01:36 +01:00
rtl8192e staging: rtl8192e: Aligning the * on each line in block comments 2017-02-02 13:12:22 +01:00
rtl8192u staging: rtl8192u: move stats_IndicateArray off stack 2017-02-03 13:01:36 +01:00
rtl8712 Staging: rtl8712: fix spelling errors 2017-01-25 11:33:21 +01:00
rts5208 staging: rts5208: remove unncessary result set and check, just return SUCCESS 2017-02-03 13:01:36 +01:00
skein staging: skein: fix checkpatch block comments warning 2017-01-20 14:39:12 +01:00
sm750fb staging:sm750fb:ddk750_chip.c removes un-necessary blank lines 2017-01-10 17:40:15 +01:00
speakup Staging: speakup: speakup_bns: fix comment 2017-01-31 09:30:58 +01:00
unisys staging: unisys: visorbus: get rid of unused payload info 2017-02-02 13:10:49 +01:00
vc04_services staging: vc04_services: Make vchi_msg_queue static 2017-01-31 10:48:14 +01:00
vme staging: vme: vme_user.c: fix warning 'line over 80 characters' 2017-01-16 18:08:56 +01:00
vt6655 staging: vt6655: Add spaces around + 2016-12-06 10:18:07 +01:00
vt6656 staging: vt6656: Add missing identifier names 2017-01-27 09:40:56 +01:00
wilc1000 staging:wilc1000:wilc_sdio.c Deleted un-needed blank lines 2017-01-16 18:10:25 +01:00
wlan-ng staging: wlan-ng: add missing byte order conversion 2017-01-31 09:30:58 +01:00
xgifb staging: xgifb: XGI_main_26: Remove multiple assignments 2017-01-27 21:09:33 +01:00
Kconfig staging: bcm2835-audio: initial staging submission 2017-01-27 09:44:31 +01:00
Makefile staging: bcm2835-audio: initial staging submission 2017-01-27 09:44:31 +01:00