From: huanghua Date: Fri, 29 Sep 2006 15:53:40 +0000 (+0000) Subject: check buffer present first, then check length, and then get buffer. X-Git-Tag: v1_8_0_110~486^2~759 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=0a8c032a51fc935ef2e3d3be5daa67fe64692d9e;p=fs%2Flustre-release.git check buffer present first, then check length, and then get buffer. --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index bf09b94..17c0d6f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1456,8 +1456,11 @@ static int mdt_body_unpack(struct mdt_thread_info *info, __u32 flags) * contains capa actually. There are some requests which do not, for * instance MDS_IS_SUBDIR. */ - if (req_capsule_has_field(pill, &RMF_CAPA1, RCL_CLIENT)) - capa = req_capsule_client_get(pill, &RMF_CAPA1); + if (req_capsule_field_present(pill, &RMF_CAPA1, RCL_CLIENT)) { + int len = req_capsule_get_size(pill, &RMF_CAPA1, RCL_CLIENT); + if (len == sizeof(struct lustre_capa)) + capa = req_capsule_client_get(pill, &RMF_CAPA1); + } obj = mdt_object_find(env, info->mti_mdt, &body->fid1, capa); if (!IS_ERR(obj)) {