X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fsec_plain.c;h=ad10a2f1f9a0ec223c69710fca010ccf533be594;hb=f52e7ac294e9091b1ef8e9f8151bd47625be5d8d;hp=7cf22e42dc1990989efacf169e6ba288ef2d9a9b;hpb=2b294992edce5af7b79d4300ed3aa1ea6a8db850;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/sec_plain.c b/lustre/ptlrpc/sec_plain.c index 7cf22e4..ad10a2f 100644 --- a/lustre/ptlrpc/sec_plain.c +++ b/lustre/ptlrpc/sec_plain.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2014, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -159,14 +159,16 @@ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc) char *ptr; unsigned int off, i; + LASSERT(ptlrpc_is_bulk_desc_kiov(desc->bd_type)); + for (i = 0; i < desc->bd_iov_count; i++) { - if (desc->bd_iov[i].kiov_len == 0) + if (BD_GET_KIOV(desc, i).kiov_len == 0) continue; - ptr = kmap(desc->bd_iov[i].kiov_page); - off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK; + ptr = kmap(BD_GET_KIOV(desc, i).kiov_page); + off = BD_GET_KIOV(desc, i).kiov_offset & ~PAGE_MASK; ptr[off] ^= 0x1; - kunmap(desc->bd_iov[i].kiov_page); + kunmap(BD_GET_KIOV(desc, i).kiov_page); return; } } @@ -341,6 +343,7 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, int rc; int i, nob; + LASSERT(ptlrpc_is_bulk_desc_kiov(desc->bd_type)); LASSERT(req->rq_pack_bulk); LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS); LASSERT(req->rq_repdata->lm_bufcount == PLAIN_PACK_SEGMENTS); @@ -354,14 +357,15 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, return 0; } - /* fix the actual data size */ - for (i = 0, nob = 0; i < desc->bd_iov_count; i++) { - if (desc->bd_iov[i].kiov_len + nob > desc->bd_nob_transferred) { - desc->bd_iov[i].kiov_len = - desc->bd_nob_transferred - nob; - } - nob += desc->bd_iov[i].kiov_len; - } + /* fix the actual data size */ + for (i = 0, nob = 0; i < desc->bd_iov_count; i++) { + if (BD_GET_KIOV(desc, i).kiov_len + + nob > desc->bd_nob_transferred) { + BD_GET_KIOV(desc, i).kiov_len = + desc->bd_nob_transferred - nob; + } + nob += BD_GET_KIOV(desc, i).kiov_len; + } rc = plain_verify_bulk_csum(desc, req->rq_flvr.u_bulk.hash.hash_alg, tokenv); @@ -893,7 +897,7 @@ int plain_authorize(struct ptlrpc_request *req) lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0), lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF), NULL, 0, (unsigned char *)&msg->lm_cksum, &hsize); - req->rq_reply_off = 0; + req->rq_reply_off = 0; } RETURN(0);