From patchwork Mon Jul 17 09:59:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Ming X-Patchwork-Id: 13315375 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0014CA927 for ; Mon, 17 Jul 2023 09:59:50 +0000 (UTC) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2112.outbound.protection.outlook.com [40.107.215.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD07186; Mon, 17 Jul 2023 02:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IhgfKXD9/0ACWxzHvKRsKRhIKa660cpUW5Uy8ECJztD8WDd3eoJcHiQBhEgYdzH+t5IW02vSO9UYFBQeTqQi9RIeLfVAtnTq1PP6rat68a8j+pEyyVVRP6dnDOB9tZYTLq5QRXxA4yDMwL9ruw1J7U77vuZb4cMt74Lscbfr4OC9FShBcK0/LqfngA+g9CgZCSKXws+QcJLtuswe2whjMttjCjMxj4EEFob0+vvBQuOaXmPxPefiGil6EHFApeJbOIOWBvgwCbrS63xWojJMit9tjoexuHbRA0wq7q6qz6bqkvpyrSBkRj7M+7oD7TkHeKtT2iYh9Q5l/blKuB33iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aW72oikfy6WLi3q3W/J0rJZArfwsMvuH2MqrU42/2Xc=; b=IB5CehlZ/QwuI2fOtajNJUY7jgw+x3ecQb2o4rot7D3ajVrkdonphxciOUqKa721A3icJbddGKBNnfPBTnffXJLas9YUCZZSK1I0jfW9NyiE7tVN9469PuECm1ALxn5oCEE8pxzQsTiNEaQ3hWUjF0iR/XQy4TvIBgHaycdQlQ3Ikrvuw5YHIDqPq/43tR5x4vPaJA38B8e/UPVOkKKyKOGP31/yRlpYWHf3Q+0MEVopM6v9KSbBCZM0JIt8+kPruxnZxhDKohlYfDjC9zcD2OVY6Pm5sbnU9FzeDAzq8WyRldIV6rbAFCNdtIpU/ctRz7gKkabEu4MDs/uwzUPZPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aW72oikfy6WLi3q3W/J0rJZArfwsMvuH2MqrU42/2Xc=; b=fPO/m8EoposyiMwHy5fJTh162eVQ+soA9BihixIAujxWW5P5+B5PV+3zCnDY6c+h2j93qUmNk/ZggDorMU98RlzhvC11/HBbiR9FP5vNyudy6hrBReuf52UpukvdbZ/deNaG8lTLMY/G9c4By0h/vEZ+LmPhFN1JbBGiQEfXJLUweQMZOmONbbwl26zToykD/gE1jqb5y0gwesny4iGzXsmgl8fGvojng2wYNnIpCB7eulff6FWL14yYx0QOHj09YQ+zIT+dMLpt33Ia+bYvH/7mUgFavO7z6ieOXcAj7X8dxpukY5R4D3CITF2aZVFz51jGossfgiYkiUmXpNOngg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SG2PR06MB3743.apcprd06.prod.outlook.com (2603:1096:4:d0::18) by PUZPR06MB5825.apcprd06.prod.outlook.com (2603:1096:301:e9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Mon, 17 Jul 2023 09:59:42 +0000 Received: from SG2PR06MB3743.apcprd06.prod.outlook.com ([fe80::2a86:a42:b60a:470c]) by SG2PR06MB3743.apcprd06.prod.outlook.com ([fe80::2a86:a42:b60a:470c%4]) with mapi id 15.20.6588.031; Mon, 17 Jul 2023 09:59:42 +0000 From: Wang Ming To: Steffen Klassert , Herbert Xu , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Wang Ming Subject: [PATCH net v1] net: ipv4: Use kfree_sensitive instead of kfree Date: Mon, 17 Jul 2023 17:59:19 +0800 Message-Id: <20230717095932.18677-1-machel@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: TYCPR01CA0043.jpnprd01.prod.outlook.com (2603:1096:405:1::31) To SG2PR06MB3743.apcprd06.prod.outlook.com (2603:1096:4:d0::18) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PR06MB3743:EE_|PUZPR06MB5825:EE_ X-MS-Office365-Filtering-Correlation-Id: df48cdb4-e192-4822-21e5-08db86ac8a69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yaxWLiu5MHyo/KC8bInUJPyCVyDRHgviOp+ACl9fNoMF5B52tfmrKYZ0pkCURWpQmoWri7vhfawjA9UxSuIAi58Mbc/5NKMUomT1xwqLufxp5F7g/F/Cog/8ep0UPA9HEAJ0C+yRKTZ1jAD/GS6PBj7svRKdsCflnPhozpcwy1F71QfnzIdmGzZf8eXXkGVWDmq4muhxUH7cYDeBrwQVN1wABotf/+TClubOydFIjTrEl9kNGY7Lf3+Pzd81L8MVSZfhZ8QJEueCT136y9WWCJ1kyXXLRv30Non9W66gGCBbSqPZXMuTcFObMXLbt+jsI4imD6Vx0RfiWk2rZsWGfElcQnGDX2pUIQkadehsmxaDpdn54hlYM++T81Tu1QRPD4OGQJ4Mm5+nAyQma+mxaroLJwtJlnYkW66rif6W5zfaMxHAsPU/8Z74OKdN5a32AxglF6xkwTe7q8erKIQo0B+dsm8uWJ/Zfm/Vf7yiBe++vbyYWnYugBp7yxPQpUtfDyoDppjw8H5t4Er0a689+30Sxduggq/CrOFPFvnzuy8Z611Eh0aW7KC400HHmDoBTrFWk8MKsmZvu5UsuQk8DukMXZiEpXWpQZmHQHS0FlnsCFRuCpH6g/YzdMD92p5Z X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR06MB3743.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(2906002)(38100700002)(86362001)(38350700002)(6512007)(83380400001)(107886003)(2616005)(186003)(1076003)(26005)(6506007)(5660300002)(36756003)(4744005)(8676002)(8936002)(478600001)(6486002)(110136005)(52116002)(6666004)(316002)(41300700001)(66476007)(66556008)(4326008)(66946007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Qy9y8lZEVI1Qm1D5StDmMqqQgIUDHGw+19sAJMvuD2SiUhamCoJqOAthLyYr2IGjrQxfX7QEoSszXSokpALjukxhPRYkV2ANg0f2tDtD1YhfmHu7+tZH9YYAeZQhpMsQgVyWunoOz0TNgedeyjXWYWJgZpPGxE0vOVau/HUqpxBkfU4T645bfG4SLFvHb/UOkSn4zqBj57Y1uy6qiHG2ohcaUiPUAeCdNc655PZLjRZBu3ALfsNfsO1YajfM0Tuz8+4b9mg7s4aHjOSPjpN0eSKOeuVEMeFL6Jv1mnm0OjqlzpKM1a3uWVAw9vtJJZB7FjxDK+TsAhvA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UCl3JCSSGi8dWiXH6N4LTXPT3jkA9Zxf8tEt7yivCS8a8uK7vj1Q2DKGpHSZTyAmVgbyzH7Dw51HupjznhWJppuhiuwBys+yrlA7UYNoTbCGBMRow1UJHfZmh6lEiMOv6qhyfv94S8KJ3MsYUVPDpCz1aAAfXmmTab8N82Z5WCNtMmF X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: df48cdb4-e192-4822-21e5-08db86ac8a69 X-MS-Exchange-CrossTenant-AuthSource: SG2PR06MB3743.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 09:59:41.9902 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tlLmlClhFMvY3IrXlwIXw+BqecYrkk55kVDn0PUWiKGGZ2b9cc5OoSemPQeXB9KuTQa9EkCmPtpxfyIPp8G0hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5825 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org key might contain private part of the key, so better use kfree_sensitive to free it. Fixes: 38320c70d282 ("[IPSEC]: Use crypto_aead and authenc in ESP") Signed-off-by: Wang Ming Reviewed-by: Tariq Toukan Reviewed-by: Kuniyuki Iwashima --- net/ipv4/esp4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index ba06ed42e428..2be2d4922557 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -1132,7 +1132,7 @@ static int esp_init_authenc(struct xfrm_state *x, err = crypto_aead_setkey(aead, key, keylen); free_key: - kfree(key); + kfree_sensitive(key); error: return err;