diff options
author | Richard Wareing <rwareing@fb.com> | 2014-10-17 18:35:56 -0700 |
---|---|---|
committer | Kevin Vigor <kvigor@fb.com> | 2017-03-05 15:18:39 -0500 |
commit | 4f9624bf078064cfcd49da714437e0ed94bbffbe (patch) | |
tree | 82fa31dda150478397caedbe96a6df98980107cb /libglusterfs/src | |
parent | 961dc5e6e7af437a77cd9736a0a925c5621b12cc (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
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/src')
-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 3399cc7c297..d51e64768aa 100644 --- a/libglusterfs/src/latency.c +++ b/libglusterfs/src/latency.c @@ -137,6 +137,13 @@ gf_update_latency (call_frame_t *frame) elapsed = (end->tv_sec - begin->tv_sec) * 1e6 + (end->tv_usec - begin->tv_usec); + if (frame->op < 0 || frame->op >= GF_FOP_MAXVALUE) { + gf_log ("[core]", GF_LOG_WARNING, + "Invalid frame op value: %d", + frame->op); + return; + } + lat = &frame->this->latencies[frame->op]; lat->total += elapsed; |