[Devel] [PATCH RHEL7 COMMIT] ms/PCC: fix dereference of ERR_PTR

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 16 14:04:07 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.10.1.vz7.162.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.10.1.vz7.162.3
------>
commit 0060ab1e1bbc2358fe543cfa3cf813c699e13b48
Author: Sudip Mukherjee <sudipm.mukherjee at gmail.com>
Date:   Wed Sep 16 19:34:24 2015 +0530

    ms/PCC: fix dereference of ERR_PTR
    
    get_pcc_channel() does not return NULL on error it returns the error code
    in ERR_PTR, but we have been checking it for NULL.
    
    Signed-off-by: Sudip Mukherjee <sudip at vectorindia.org>
    
    https://jira.sw.ru/browse/PSBM-104581
    
    (cherry picked from commit d311a28a5853857a73d54d15dc30797aa3b1802d)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/mailbox/pcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 0a48739ae7e42..838e6cf4717e8 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -253,7 +253,7 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 	 */
 	chan = get_pcc_channel(subspace_id);
 
-	if (!chan || chan->cl) {
+	if (IS_ERR(chan) || chan->cl) {
 		dev_err(dev, "Channel not found for idx: %d\n", subspace_id);
 		return ERR_PTR(-EBUSY);
 	}


More information about the Devel mailing list