diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 745adbb74cfce7eb34a8ba11cd5ce9a8c7ee23ee..7640e179e39db47ca00120b9d75b19fafeddae56 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -264,6 +264,8 @@ #define LDLM_MAXREQSIZE (5 * 1024) #define LDLM_MAXREPSIZE (1024) +#define MDS_MAXREQSIZE (5 * 1024) /* >= 4736 */ + #define OST_MAXREQSIZE (5 * 1024) /* Macro to hide a typecast. */ diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 7fbc18e3e654a19484b8f7c028f9964256eea72c..c391b60394e4183760d77c184fdb5035cc37adbf 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1804,6 +1804,11 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) /* Compute the whole struct size */ totalsize = hur_len(hur); OBD_FREE_PTR(hur); + + /* Final size will be more than double totalsize */ + if (totalsize >= MDS_MAXREQSIZE / 3) + return -E2BIG; + OBD_ALLOC_LARGE(hur, totalsize); if (hur == NULL) return -ENOMEM;