From 135208d92c405749e231b91d66118439e6282338 Mon Sep 17 00:00:00 2001 From: "hongchao.zhang" Date: Sat, 2 Apr 2011 14:26:33 +0800 Subject: [PATCH] LU-212 reject connection with bad ocd_brw_size in obdfilter, rejecting connection request with -EPROTO if OBD_CONNECT_BRW_SIZE is set in obd_connect_data->ocd_connect_flags, but "ocd_brw_size" in it is zero. Change-Id: Iba002250a11ab7321dbb5d4f398dde5ebd00c11d Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/431 Reviewed-by: Andreas Dilger Tested-by: Hudson Reviewed-by: Oleg Drokin --- lustre/obdfilter/filter.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 501652d..f60190d 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2704,7 +2704,18 @@ static int filter_connect_internal(struct obd_export *exp, } else if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) { data->ocd_brw_size = min(data->ocd_brw_size, (__u32)(PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT)); - LASSERT(data->ocd_brw_size); + if (data->ocd_brw_size == 0) { + CERROR("%s: cli %s/%p ocd_connect_flags: "LPX64 + " ocd_version: %x ocd_grant: %d ocd_index: %u " + "ocd_brw_size is unexpectedly zero, " + "network data corruption?" + "Refusing connection of this client\n", + exp->exp_obd->obd_name, + exp->exp_client_uuid.uuid, + exp, data->ocd_connect_flags, data->ocd_version, + data->ocd_grant, data->ocd_index); + RETURN(-EPROTO); + } } if (data->ocd_connect_flags & OBD_CONNECT_CKSUM) { -- 1.8.3.1