From 47d7e7441fc2887fd63705c1309e5636df2bdcf4 Mon Sep 17 00:00:00 2001 From: Richard Wareing Date: Fri, 17 Oct 2014 18:35:56 -0700 Subject: Fixes gNFSd gf_update_latency crashes Summary: - Per title, does a bounds check on the frame->op and bails from the function if it's invalid preventing the crash Test Plan: Prove tests Reviewers: dph, jackl Reviewed By: jackl FB-commit-id: e67cc15 Change-Id: If1a5a9c0630573d4a6615050a9114ccf532551c7 BUG: 1522847 Signed-off-by: Kevin Vigor Reviewed-on: https://review.gluster.org/16847 CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Smoke: Gluster Build System Reviewed-by: Shreyas Siravara --- libglusterfs/src/latency.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c index 076c019c607..fb3b155caa6 100644 --- a/libglusterfs/src/latency.c +++ b/libglusterfs/src/latency.c @@ -37,6 +37,13 @@ gf_update_latency (call_frame_t *frame) elapsed = (end->tv_sec - begin->tv_sec) * 1e9 + (end->tv_nsec - begin->tv_nsec); + if (frame->op < 0 || frame->op >= GF_FOP_MAXVALUE) { + gf_log ("[core]", GF_LOG_WARNING, + "Invalid frame op value: %d", + frame->op); + return; + } + /* Can happen mostly at initiator xlator, as STACK_WIND/UNWIND macros set it right anyways for those frames */ if (!frame->op) -- cgit