From patchwork Thu Feb 22 14:22:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 129252 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp650884lja; Thu, 22 Feb 2018 06:23:32 -0800 (PST) X-Google-Smtp-Source: AH8x225MknV76E2Fdwix9ps5nJ8lyD4y7vFs3MVA33KZ9K/mOfvotumhC91o0uhku9S1ME1C4UH8 X-Received: by 2002:a17:902:b215:: with SMTP id t21-v6mr6859056plr.414.1519309412132; Thu, 22 Feb 2018 06:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519309412; cv=none; d=google.com; s=arc-20160816; b=nUXXEommRrGQYXfa7L+/GLslzYC2gTMfcjoUJv9gi/3sG3ywysjcYoaPnbQajrMLoo cOMjOQJ8ZN6jlyMZb24wZ9a5nKPWkZxaw8Gls8mcv36r7LYSpQ4uDFkfJ/mxh8UlNZnT TmOteX3AZOKZkQ05zHOkY6hpm0ITK1uYMoX9w6i6hKxGIdqti/2PJsJ5cNchcTysYO1P 4pD+O+Jgn8s28AbW76CrwuqXIFAsRsMdktcJsqDXIaJhBBTUDh5Zah3oXi6amWFsrD4S 1XThlmu1sMzwVgaQXI9MhLy+xuzFM85F3ufyeNIyVBTyhUmmRBKD8aJP0Xg4K0F60beo JK3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Wh8QljMeAjFdEXTPy7ohXGq00a0zQ29xSWkC2pVDqaI=; b=sKZxobxSVtGsM0xFgcH3iEH7icSSxm56iMyyiflaW7gIl7pvZkSFYC6Zgf9qte8IXh h8fT/z9SSK8rXSaM+5DWhEZ0jtyvM/jbwJ0cUT9jpN6UYRzeIN1JjbHNEoZcIjqOphiA 00jBqVDwiaoJuxLk6yGmApdFQjEyAKUOc03BJKH7C09KRmZ++fB/46LCwiAQnddU30UG 2E7P/EenuFkjvqHa9EtibP7HKVkBSCzsK3UJ9sL/iaRr8M6P2ZRq/k1umXkCG42P/4lH MZDTPgmXdxLrl5O2OXuR5HteeRRO8aKkoAvcQRxUktBZz0Gv3QXGmvZCkxJbdmvIAHNQ D4xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EM0jsAKB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i70si101111pgc.86.2018.02.22.06.23.31; Thu, 22 Feb 2018 06:23:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EM0jsAKB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932852AbeBVOX1 (ORCPT + 28 others); Thu, 22 Feb 2018 09:23:27 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39709 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932815AbeBVOXW (ORCPT ); Thu, 22 Feb 2018 09:23:22 -0500 Received: by mail-wm0-f67.google.com with SMTP id 191so4028040wmm.4 for ; Thu, 22 Feb 2018 06:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wh8QljMeAjFdEXTPy7ohXGq00a0zQ29xSWkC2pVDqaI=; b=EM0jsAKBu/dyzWzUAG+5jTVc7D9/FEJRNZg/nb2lTB1BKQPnuzGccTWb/LNfSdW0bg oxY5FRFfqd4N2s7ldoVWdspgWs7/tbWcguO8IBZizM4P6RxF3mICDePn/Q4JvqwykXM2 ti7TcZPBkgqVffJEfepmBFujrjxoBNjGRm3kM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wh8QljMeAjFdEXTPy7ohXGq00a0zQ29xSWkC2pVDqaI=; b=A6BF4aGRnJR5JUE7DeYLjOUWF3hgbiUFyL1F/dZrIy9OWc+qbglt9UwwGHHqeI1boA ENSOCu/25TzX0vbbcfDtezth4I4jrEnkZ0IlM0jqdza97qTHgMJn6bH97//uqh0TMd1F hykttkS2YTS3vMX7aiC7O5wihhHboye+KyC9w26eEf+Mpl2LPGzBE+RTx2KIq1skM8M5 CWG3oezSjr0giknJiNocPzpxKjBYo/24bLoYY8ffrvHuuylLJu2He4+84OXEnsmnBtfH 61bj1kKkkcjeqnQAD+ooT5pIyXs9OYb+hJbqFxN/SUVFHSLvPBRpJBUR0baNtLrKUdv5 q8qw== X-Gm-Message-State: APf1xPBwaB8YpXdbHkbvnc2YfQ9AjG9BcCsUo3qStyE1Z4ap/y7T8ihd li7WfyTn9C5ZF/v0gfmI3x2Wuw== X-Received: by 10.28.109.10 with SMTP id i10mr5501773wmc.107.1519309400979; Thu, 22 Feb 2018 06:23:20 -0800 (PST) Received: from arch-late.localdomain (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id g96sm239784wrd.73.2018.02.22.06.23.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 06:23:20 -0800 (PST) From: Rui Miguel Silva To: horia.geanta@nxp.com, aymen.sghaier@nxp.com, Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Ryan Harkin , Bryan O'Donoghue , Rui Miguel Silva , Fabio Estevam , Peng Fan , "David S. Miller" , Lukas Auer , stable@vger.kernel.org Subject: [PATCH v4 1/4] crypto: caam - Fix null dereference at error path Date: Thu, 22 Feb 2018 14:22:47 +0000 Message-Id: <20180222142250.31348-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180222142250.31348-1-rui.silva@linaro.org> References: <20180222142250.31348-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org caam_remove already removes the debugfs entry, so we need to remove the one immediately before calling caam_remove. This fix a NULL dereference at error paths is caam_probe fail. Fixes: 67c2315def06 ("crypto: caam - add Queue Interface (QI) backend support") Tested-by: Ryan Harkin Cc: "Horia Geantă" Cc: Aymen Sghaier Cc: Fabio Estevam Cc: Peng Fan Cc: "David S. Miller" Cc: Lukas Auer Cc: # 4.12+ Reviewed-by: Horia Geantă Signed-off-by: Rui Miguel Silva --- drivers/crypto/caam/ctrl.c | 3 --- 1 file changed, 3 deletions(-) -- 2.16.2 diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index e843cf410373..361e750f9cba 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -815,9 +815,6 @@ static int caam_probe(struct platform_device *pdev) return 0; caam_remove: -#ifdef CONFIG_DEBUG_FS - debugfs_remove_recursive(ctrlpriv->dfs_root); -#endif caam_remove(pdev); return ret;