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 727BFE95A67 for ; Sat, 7 Oct 2023 15:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343696AbjJGPK2 (ORCPT ); Sat, 7 Oct 2023 11:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbjJGPK2 (ORCPT ); Sat, 7 Oct 2023 11:10:28 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED041B9; Sat, 7 Oct 2023 08:10:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72083C433C8; Sat, 7 Oct 2023 15:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696691425; bh=LH6IWkmyMSvjK2Q3N3HjTHI8GVBa4KuURUr6eXtccys=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kIzj7hK0L/DbwMAVrxGzakiLql+kw3pXx1ew0g45ixAo3GNkeQrZzd9PuDWCWxF0Q 9IBOXzzVpCsDt4JbpDmYgKUBKpNX66jLsOOr9tVCZ3XSODwohF1YU51Wz+vb8VDu74 8Hmcp5ZInqFxhE0tUi7gjmR1snrHvZNqezzcM1Vyz/ZSBAYEgwoRvJzHA7kujsBVpi 2REy0U1jFFh3BGvyd+PmEiqEfNdsyDXsBeKG+hQKKqnvjFFCyUT799FTz4+7oUYpCo YaRyhio3Qc2+RS1XQBg66Gx7nlykEqJT67KZ7rKF79iuhooOR4XCaxgUXM4A8/t7Fp XhWS0vNlAW3HQ== Date: Sat, 7 Oct 2023 17:10:21 +0200 From: Simon Horman To: Chengfeng Ye Cc: jreuter@yaina.de, ralf@linux-mips.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-hams@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] ax25: Fix potential deadlock on &ax25_list_lock Message-ID: <20231007151021.GC831234@kernel.org> References: <20231005072349.52602-1-dg573847474@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231005072349.52602-1-dg573847474@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-hams@vger.kernel.org On Thu, Oct 05, 2023 at 07:23:49AM +0000, Chengfeng Ye wrote: > Timer interrupt ax25_ds_timeout() could introduce double locks on > &ax25_list_lock. > > ax25_ioctl() > --> ax25_ctl_ioctl() > --> ax25_dama_off() > --> ax25_dev_dama_off() > --> ax25_check_dama_slave() > --> spin_lock(&ax25_list_lock) > > --> ax25_ds_timeout() > --> spin_lock(&ax25_list_lock) > > This flaw was found by an experimental static analysis tool I am > developing for irq-related deadlock. > > To prevent the potential deadlock, the patch use spin_lock_bh() > on &ax25_list_lock inside ax25_check_dama_slave(). > > Fixes: c19c4b9c9acb ("[AX.25]: Optimize AX.25 socket list lock") > Signed-off-by: Chengfeng Ye Hi Chengfeng Ye, Are there other functions that spin_lock(&ax25_list_lock) that also need to use spin_lock_bh()? ...