From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6A92A00C3; Tue, 25 Jan 2022 15:23:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 966FA429D6; Tue, 25 Jan 2022 15:23:27 +0100 (CET) Received: from out162-62-58-216.mail.qq.com (out162-62-58-216.mail.qq.com [162.62.58.216]) by mails.dpdk.org (Postfix) with ESMTP id DE138426E4 for ; Tue, 25 Jan 2022 15:23:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1643120603; bh=ZpCricik5iw8EgddVh7cn+WQl/R/2QQdUudcRah+SWw=; h=From:To:Cc:Subject:Date; b=qoVlP/0Hvxx7GcGgjYJFZwviB6NMdiVe74YG+rFmzTlpPcXzqGW4Kf59mwIpoGq67 NvZefksPikUt2xjEVgRmofjFIrBC/U33yx79TgYzyIUEi4ZNamkD2c3/6SkTuyUW5l eDDAtI7ru+3vq+sM8KtZvuDdQUgFNCkvRaGuxTN0= Received: from localhost.localdomain ([111.193.130.237]) by newxmesmtplogicsvrszc11.qq.com (NewEsmtp) with SMTP id 5CEAC616; Tue, 25 Jan 2022 22:23:14 +0800 X-QQ-mid: xmsmtpt1643120594t2zwbbzpb Message-ID: X-QQ-XMAILINFO: Nzizwv7CsWRemtuFZXyztTKSJYj8B8w+3b3tlXFh1fkuV7uZvjowbCCy3oxRS7 oKmHOpj2QKGH0Fm0El9guhbUVkrqcmFHairz292RnMtfo2mKG7NXJFyeWQ5LJ/pSviJ/XX8usHcv h/ayRqCFIyAQiytqmhtO6hqLxCvsYWMQzyCVQXVfsUhheA0QwRBT5Ew1KJYm4BY+ZzqN/cLDk9Km UAs9xVxX8u40JVhUP5SxSdvrTsS6kxGjg5sc+RLJyq/85cRaxty9YYADPqqbTyh8Ml4cPha81sXq 5Rj6SQk9HTcX6xKK83Bu7KO2asEEddrD56PSi6opdJR++5cwdHBCDElqPPNcGemZgKEl2ysAem/V wCdQ3iQVmu7+MQ4q/lSLJi7r7uX47/f9rDuzBXizeH7ihTs2/lqjjgfKczUFa2fBHX+/yfy32OL+ 4emlepWVAkH1cHuY9CqYrRVbdh0IU667ULMYDwo5N6MV/kJzmCWHcDvCOwrLAYkDvEbbPeifSuwl LCu4jHZ3j0ijru9k0bpOAkTKg8RNTWpy2KveN1UWojsiLDOEk7G2gGysHHle+7jtlI9zgrVvpahg Ig8Si7hHEwyYhJd1C1GENbrQPC6SzzApck/8EiLw4TxIIKcUfrmhi9+5RVLN9JWv5dpSxwrnlCDU PijBNuKU1peZlOfSJj1U3ccu+cRC88kZqDpqw/Drabug56OcCxpguqnkQnokH+aTcHptCBx6e0sb LqYmi4IU2q4rSnnkxsPoE0hMD2i7eJFjt+g6RfyAwu/bUTX93gt5LHuElQePQ/0MtPKXGGdolE2y UqIltp5kbZ8AR0bhHoPoaryea3FOBQhq6zZ6sS8GXHkCFNGrYrOUvBlevI5dQoLy+eu/vFpJd1cA == From: Weiguo Li To: jingjing.wu@intel.com Cc: radu.nicolau@intel.com, dev@dpdk.org Subject: [PATCH] net/iavf: fix null pointer dereference Date: Tue, 25 Jan 2022 22:23:14 +0800 X-OQ-MSGID: <20220125142314.32194-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Check for memory allocation failure is added to avoid null pointer dereference. Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Signed-off-by: Weiguo Li --- drivers/net/iavf/iavf_ipsec_crypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c index adf101ab8a..ac67aa28f7 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.c +++ b/drivers/net/iavf/iavf_ipsec_crypto.c @@ -1352,6 +1352,8 @@ iavf_ipsec_crypto_set_security_capabililites(struct iavf_security_ctx capabilities = rte_zmalloc("crypto_cap", sizeof(struct rte_cryptodev_capabilities) * (number_of_capabilities + 1), 0); + if (!capabilities) + return (-ENOMEM); capabilities[number_of_capabilities].op = RTE_CRYPTO_OP_TYPE_UNDEFINED; /** -- 2.25.1