From 7e6640f811425b2a8c4e8d60f655d400283a4af7 Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 14 Apr 2009 20:18:52 +0000 Subject: [PATCH] Branch b_release_1_8_0 Validate LOV EA magic when passed from userspace. Don't send bogus LOV EA data if an internal flag is passed to open. b=19115 o=andrew.perepechko i=adilger i=alexander.zarochentsev --- lustre/lov/lov_pack.c | 5 +++++ lustre/mdc/mdc_lib.c | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index dbf615e..75da6ad 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -435,6 +435,11 @@ int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, rc = lustre_swab_lov_user_md(lumv1); if (rc) RETURN(rc); + } else if ((lumv1->lmm_magic != LOV_USER_MAGIC_V1) && + (lumv1->lmm_magic != LOV_USER_MAGIC_V3_SWABBED)) { + CDEBUG(D_IOCTL, "bad userland LOV MAGIC: %#08x\n", + lumv1->lmm_magic); + RETURN(-EINVAL); } /* in the rest of the tests, as *lumv1 and lumv3 have the same diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 579e6d5..9b3ebf3 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -236,9 +236,8 @@ void mdc_create_pack(struct ptlrpc_request *req, int offset, static __u32 mds_pack_open_flags(__u32 flags) { __u32 cr_flags = (flags & (FMODE_READ | FMODE_WRITE | - MDS_OPEN_DELAY_CREATE | MDS_OPEN_HAS_EA | - MDS_OPEN_HAS_OBJS | MDS_OPEN_OWNEROVERRIDE | - MDS_OPEN_LOCK)); + MDS_OPEN_DELAY_CREATE | MDS_OPEN_HAS_OBJS | + MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK)); if (flags & O_CREAT) cr_flags |= MDS_OPEN_CREAT; if (flags & O_EXCL) -- 1.8.3.1