Whamcloud - gitweb
LU-3627 quota: Fix incorrect NULL return value of qsd_init() 00/7100/2
authorLi Xi <lixi@ddn.com>
Fri, 26 Jul 2013 11:01:57 +0000 (04:01 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 26 Jul 2013 18:37:26 +0000 (18:37 +0000)
qsd_init() might return NULL in some cases, which is not correct and
may make kernel crash. This patch fixes this problem.

Signed-off-by: Li Xi <lixi@ddn.com>
Change-Id: I604077f2f9143e500badb5148a6f0d9a246e375f
Reviewed-on: http://review.whamcloud.com/7100
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/quota/qsd_lib.c

index dfbf8a2..2a665cc 100644 (file)
@@ -535,7 +535,7 @@ struct qsd_instance *qsd_init(const struct lu_env *env, char *svname,
        /* only configure qsd for MDT & OST */
        type = server_name2index(svname, &idx, NULL);
        if (type != LDD_F_SV_TYPE_MDT && type != LDD_F_SV_TYPE_OST)
        /* only configure qsd for MDT & OST */
        type = server_name2index(svname, &idx, NULL);
        if (type != LDD_F_SV_TYPE_MDT && type != LDD_F_SV_TYPE_OST)
-               RETURN(NULL);
+               RETURN(ERR_PTR(-EINVAL));
 
        /* allocate qsd instance */
        OBD_ALLOC_PTR(qsd);
 
        /* allocate qsd instance */
        OBD_ALLOC_PTR(qsd);