From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFCFCC77B60 for ; Sun, 23 Apr 2023 13:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229456AbjDWNYT (ORCPT ); Sun, 23 Apr 2023 09:24:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDWNYS (ORCPT ); Sun, 23 Apr 2023 09:24:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C509E6D for ; Sun, 23 Apr 2023 06:24:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B04F760D30 for ; Sun, 23 Apr 2023 13:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E441C433EF; Sun, 23 Apr 2023 13:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682256257; bh=bkhXU91t61rMhy2+V9J7vBlWXWsHR2XVwEcqkN4Mgvk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F2OCQcL1QgXx+nKXnuD+k7orYppvouoUDasco7zFpnfW9SavPQaYeyXYd9my7x2BD T0B7EEGxCJDhGpyhrue1Lg5cjzbC4vczGOHvGK52Gs+z7G7EI2DCreM0dC2NUg2FgM Qqgr3XAM5fnk6ccB7xlsH7YnluBQOfhUNqMKAy4PT51zYaNG2p/J8wqsmIOlvW2/xW 6pEWP4MhYDgMcy9Gw9i1YAOKuBAHiahdIHfHf6i8XLLqMNU0krOoRzJn+iEgeW0lAi 2OQ08GoljD+XviTNQZlz0GgD2zwuz5aOjbMb+LZT7Eje8XEcB4fh39HTxwaJSeDBsP Dz37P58ud53Dw== Date: Sun, 23 Apr 2023 16:24:12 +0300 From: Leon Romanovsky To: Dan Carpenter Cc: linux-rdma@vger.kernel.org Subject: Re: [bug report] net/mlx5e: Generalize IPsec work structs Message-ID: <20230423132412.GB4782@unreal> References: <9ef32c2b-8e07-486b-af8d-9d332d5426ab@kili.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ef32c2b-8e07-486b-af8d-9d332d5426ab@kili.mountain> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Thu, Apr 20, 2023 at 11:24:09AM +0300, Dan Carpenter wrote: > Hello Leon Romanovsky, > > This is a semi-automatic email about new static checker warnings. > > The patch 4562116f8a56: "net/mlx5e: Generalize IPsec work structs" > from Mar 30, 2023, leads to the following Smatch complaint: > > drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c:755 mlx5e_xfrm_free_state() > error: we previously assumed 'sa_entry->work' could be null (see line 746) Thanks for the report, I fixed it in commit 94edec448479 ("net/mlx5e: Properly release work data structure") > > drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c > 745 > 746 if (sa_entry->work) > ^^^^^^^^^^^^^^ > > 747 cancel_work_sync(&sa_entry->work->work); > 748 > 749 if (sa_entry->dwork) > ^^^^^^^^^^^^^^^ > These checks can be deleted, right? > > 750 cancel_delayed_work_sync(&sa_entry->dwork->dwork); > 751 > 752 mlx5e_accel_ipsec_fs_del_rule(sa_entry); > 753 mlx5_ipsec_free_sa_ctx(sa_entry); > 754 kfree(sa_entry->dwork); > 755 kfree(sa_entry->work->data); > ^^^^^^^^^^^^^^^^^^^^ > Unchecked dereference. > > 756 kfree(sa_entry->work); > 757 sa_entry_free: > > regards, > dan carpenter