From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710054.outbound.protection.outlook.com [40.107.71.54]) by dpdk.org (Postfix) with ESMTP id D92BF58FE for ; Sun, 11 Nov 2018 16:24:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WQ1zNYdBdDRgnmnUlKpOeHAJGO9v7EwKKeOSSk4eeWM=; b=eNPK2hG1RGigEfbbZ4X6LQzN+EGE0UiA5rlm1KepKybbkvloLTWLiXaoKlQ9GUKu8o/XHdFsxigYvfpsr8QwOpPNLjIua3Iazrzy069SL3r9JRdCiGPWwccvOztmUHDeQIdqHPuV458IaTosp+5dGhW6MTlWBayuV1wE3tnboM0= Received: from SN6PR07MB4911.namprd07.prod.outlook.com (52.135.77.157) by SN6PR07MB4846.namprd07.prod.outlook.com (52.135.73.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Sun, 11 Nov 2018 15:24:42 +0000 Received: from SN6PR07MB4911.namprd07.prod.outlook.com ([fe80::cd76:e8cc:c0:ebf4]) by SN6PR07MB4911.namprd07.prod.outlook.com ([fe80::cd76:e8cc:c0:ebf4%3]) with mapi id 15.20.1294.044; Sun, 11 Nov 2018 15:24:42 +0000 From: Anoob Joseph To: Akhil Goyal , Pablo de Lara CC: "Joseph, Anoob" , "Jacob, Jerin" , "Athreya, Narayana Prasad" , "Dwivedi, Ankur" , "dev@dpdk.org" Thread-Topic: [PATCH 3/3] crypto/octeontx: fix null pointer dereferencing Thread-Index: AQHUedKrCxQgwR7i5kOaEmFrvrganw== Date: Sun, 11 Nov 2018 15:24:42 +0000 Message-ID: <1541949837-9629-4-git-send-email-anoob.joseph@caviumnetworks.com> References: <1541949837-9629-1-git-send-email-anoob.joseph@caviumnetworks.com> In-Reply-To: <1541949837-9629-1-git-send-email-anoob.joseph@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [115.113.156.2] x-clientproxiedby: BM1PR0101CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::25) To SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; SN6PR07MB4846; 6:uz7GhVOswLwBsep/BWp1Laoih2CURSCNoQg4Y1uV+N1iRFrz0F3l2XWbcT+viUQTsCreKsGEKC4UsaSUyws9VQ+mNy5RvdsokQs0MR3T9h53YTI9nE2wlI6JCMdp4EiqQLiEjVeKcpib9MuuHa7APNaHQdPSRa0Bq2RzEKrRDoCBvKLI33jY2E9uQLZb7N0w18WN96AAx3igxQyD73WRzxLDwd1xk3jz5Lsx5OVU8Qt4RrM/A+/Rxng0ACWezd9zdxusEFL/6rksQoi148ciOpWFHVJ69lySCrbwvtE/xydy+MMxmM5zzZhuREg1UQpQUX6dCF0m4dx+1r5WLrmk4owtv3gtIv2O6Rnk0U45vmNN4GknVhPMxN7OHi6yMd0vNEz3Cirti3CYpI7HkjOsZ8fv2M6kPBf+jOaQAKnBT7q3aGWggOZ2Mf75KsRCiU9KSGNF23O9FkEj/n6MADuqvQ==; 5:XFTGRW0bLht6b7KI4K0q4vgky3Xj+mkpETyWGB0bSuLw0+YNDuArOsPyaPSa9RTAmsGcIhUEECM6o8NN6EnpadFq37rJZlVPl0Ua5rST903XhkwtTPskWHNAod6ruk75i5luJNFsRvNCprRFKEUSDB4oGNHM+Ezv6KzgEmYh1Ww=; 7:eqdqkpp7zzPIRg3GDrAa+qId+jBDRxeir387RVFs4ItnZOBDuvAL+reMjIgvlB5atkuiZjyxbYLYXv22/x/cMbad1y+CJFs5iZ/WwSsabRTMNqdw/7uKPojGnv3Kf94wLFyLO7sXkkN+J2vgmVOqkg== x-ms-office365-filtering-correlation-id: 3d4e237e-b874-4978-de9b-08d647e9cd4e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4846; x-ms-traffictypediagnostic: SN6PR07MB4846: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231402)(944501410)(52105112)(10201501046)(3002001)(93006095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:SN6PR07MB4846; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4846; x-forefront-prvs: 08534B37A7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(136003)(39850400004)(366004)(376002)(396003)(199004)(189003)(478600001)(6486002)(11346002)(446003)(2616005)(486006)(4326008)(476003)(66066001)(105586002)(5660300001)(6436002)(106356001)(68736007)(305945005)(2900100001)(7736002)(26005)(76176011)(42882007)(52116002)(14454004)(72206003)(25786009)(99286004)(97736004)(316002)(256004)(14444005)(71190400001)(110136005)(6116002)(54906003)(6512007)(53936002)(8936002)(81156014)(2906002)(575784001)(3846002)(386003)(186003)(102836004)(6506007)(55236004)(8676002)(71200400001)(81166006)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4846; H:SN6PR07MB4911.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: izZkcR6KGyWgYbB05Un5bd0aKVyWhfg8isfuPvlvfZmEnb1H9XKHPNIh3bydY2hqOP3pWqvEn8CtVFySn1Ko7y8xLdRe6iU/mjmvM+8LX4714uVT0L1OhuG9vJNbxU0gN+7uoZ1Q3jfRvSwTgJpik6WB2rF8rZkp0w8Zkd10coMNYnaVm+DEXgmElgPjQm59mBjxgxjkPuMoM27T5gzI/aQU2ab8mCQFxUb2A+HBzTnW106eYmo2BE2dwJS6qpmxc17wKroWlBg84eets+lV4ISd8GDDstDD5TORU3ORat+vrhbNyqE/7EShyS0rq1YPHvhupvOVx1b9QUl1HQjtJ4hZiTMm6hR0RmEGDwQK7xk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d4e237e-b874-4978-de9b-08d647e9cd4e X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2018 15:24:42.3088 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4846 Subject: [dpdk-dev] [PATCH 3/3] crypto/octeontx: fix null pointer dereferencing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Nov 2018 15:24:44 -0000 The function otx_cpt_get_resource() would be setting the pointer 'instance'. In case of error, 'instance' would be set to NULL, and returns rte_errno. If rte_errno when 'instance' is set to NULL, it can lead to NULL pointer dereferencing. Fixes: 0961348fdf52 ("crypto/octeontx: add queue pair functions") Signed-off-by: Anoob Joseph --- drivers/crypto/octeontx/otx_cryptodev_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/o= cteontx/otx_cryptodev_ops.c index 23f9659..90d0c14 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -216,7 +216,7 @@ otx_cpt_que_pair_setup(struct rte_cryptodev *dev, } =20 ret =3D otx_cpt_get_resource(cptvf, 0, &instance); - if (ret !=3D 0) { + if (ret !=3D 0 || instance =3D=3D NULL) { CPT_LOG_ERR("Error getting instance handle from device %s : " "ret =3D %d", dev->data->name, ret); return ret; --=20 2.7.4