diff options
author | Richard Wareing <rwareing@fb.com> | 2014-10-17 18:35:56 -0700 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-12-07 03:44:08 +0000 |
commit | 47d7e7441fc2887fd63705c1309e5636df2bdcf4 (patch) | |
tree | a936f7710c869eccc56a54e311e83b70b9a707ad /libglusterfs | |
parent | f6aa6141d035f488cd6275ac8fc447face231107 (diff) |
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 <kvigor@fb.com>
Reviewed-on: https://review.gluster.org/16847
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/latency.c | 7 |
1 files changed, 7 insertions, 0 deletions
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) |