Whamcloud - gitweb
LU-16097 quota: fix Null pointer dereference 30/53330/3
authorHongchao Zhang <hongchao@whamcloud.com>
Sun, 26 Nov 2023 11:56:43 +0000 (19:56 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 20 Dec 2023 01:59:17 +0000 (01:59 +0000)
The "qbody" should be checked whether it is NULL or not.

CoverityID: 410242 ("Dereference after null check")

Fixes: 57ac32a2 ("LU-16097 quota: release preacquired quota when over limits")
Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Change-Id: Idab61f3ebac24307c6d5db0d42429914858d21cb
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53330
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/quota/qsd_handler.c

index 7e19ccf..639ae59 100644 (file)
@@ -236,6 +236,9 @@ static bool qsd_calc_adjust(struct lquota_entry *lqe, struct quota_body *qbody)
         * 1. revoke all extra grant
         */
        if (lqe->lqe_revoke) {
+               if (qbody == NULL)
+                       RETURN(true);
+
                lqe->lqe_revoke = 0;
 
                LQUOTA_DEBUG(lqe, "revoke pre-acquired quota: %llu - %llu\n",