diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 3ce0b4513ca480732edb5fe57df5e3560067f32b..fffb62ea791c387df96ba5b24f6f14f75cdf7a5f 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -60,6 +60,11 @@ Bugzilla   : 12606
 Description: don't use GFP_* in generic Lustre code.
 Details    : Use cfs_alloc_* functions and CFS_* flags for code portability.
 
+Severity   : normal
+Bugzilla   : 12333
+Description: obdclass is limited by single OBD_ALLOC(idarray)
+Details    : replace OBD_ALLOC/OBD_FREE with OBD_VMALLOC/OBD_VFREE
+
 --------------------------------------------------------------------------------
 
 2007-07-30         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c
index ff52ef622b7df6c7c81af0601e5b052ac800e175..46fdca0bba972a91522231f3980f080c48dcdf1c 100644
--- a/lustre/obdclass/llog_obd.c
+++ b/lustre/obdclass/llog_obd.c
@@ -366,14 +366,16 @@ int llog_cat_initialize(struct obd_device *obd, int count,
                         struct obd_uuid *uuid)
 {
         char name[32] = CATLIST;
-        struct llog_catid *idarray;
+        struct llog_catid *idarray = NULL;
         int size = sizeof(*idarray) * count;
         int rc;
         ENTRY;
 
-        OBD_ALLOC(idarray, size);
-        if (!idarray) 
-                RETURN(-ENOMEM);
+        if (count) {
+                OBD_VMALLOC(idarray, size);
+                if (!idarray)
+                        RETURN(-ENOMEM);
+        }
 
         rc = llog_get_cat_list(obd, obd, name, count, idarray);
         if (rc) {
@@ -394,7 +396,8 @@ int llog_cat_initialize(struct obd_device *obd, int count,
         }
 
  out:
-        OBD_FREE(idarray, size);
+        if (idarray)
+                OBD_VFREE(idarray, size);
         RETURN(rc);
 }
 EXPORT_SYMBOL(llog_cat_initialize);
diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh
index 034fb6b01e3d4f88a8526ded6facaacce3518120..f207d8182218697bd010f75c7bffe32e97b06006 100644
--- a/lustre/tests/conf-sanity.sh
+++ b/lustre/tests/conf-sanity.sh
@@ -1127,6 +1127,29 @@ test_32b() {
 }
 run_test 32b "Upgrade from 1.4 with writeconf"
 
+test_33() { # bug 12333
+        local FSNAME2=test1234
+        local fs2mds_HOST=$mds_HOST
+        local fs2ost_HOST=$ost_HOST
+        local fs2mdsdev=${MDSDEV}_2
+        local fs2ostdev=$(ostdevname 1)_2
+        add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
+        add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=`hostname`@tcp --reformat $fs2ostdev || exit 10
+
+        start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
+        start fs2ost $fs2ostdev $OST_MOUNT_OPTS
+        mkdir -p $MOUNT2
+        mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
+        echo "ok."
+
+        umount -d $MOUNT2
+        stop fs2ost -f
+        stop fs2mds -f
+        rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
+        cleanup_nocli || return 6
+}
+run_test 33 "Mount ost with a large index number"
+
 umount_client $MOUNT	
 cleanup_nocli