From 08109ed5a7e09ec14ecb3640cfcaf9b32d83499b Mon Sep 17 00:00:00 2001 From: Shyam Date: Fri, 24 Oct 2014 15:44:22 -0400 Subject: xlator/io-stat: Check and copy loc->path Cases where loc->path is NULL, the current code in create/open/mkdir would copy the same blindly and as a result coredump. This is a preventive fix for the coredump. The reason for loc->path to be NULL in certain cases is yet to be determined. One such case is when resolve_loc_touchup fails to get inode_path due to loops in the inode table. Change-Id: Ic2ddf2cc9f2acaf9b939afc11afd193b4402ee7c BUG: 1159221 Signed-off-by: Shyam Reviewed-on: http://review.gluster.org/9029 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/debug/io-stats/src/io-stats.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/debug') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 9033d724dc2..e6e57c37451 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1549,6 +1549,9 @@ io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct ios_stat *iosstat = NULL; char *path = frame->local; + if (!path) + goto unwind; + UPDATE_PROFILE_STATS (frame, MKDIR); if (op_ret < 0) goto unwind; @@ -1979,7 +1982,8 @@ int io_stats_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata) { - frame->local = gf_strdup (loc->path); + if (loc->path) + frame->local = gf_strdup (loc->path); START_FOP_LATENCY (frame); @@ -2093,7 +2097,8 @@ int io_stats_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata) { - frame->local = gf_strdup (loc->path); + if (loc->path) + frame->local = gf_strdup (loc->path); START_FOP_LATENCY (frame); @@ -2110,7 +2115,8 @@ io_stats_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) { - frame->local = gf_strdup (loc->path); + if (loc->path) + frame->local = gf_strdup (loc->path); START_FOP_LATENCY (frame); -- cgit