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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6CE9C369A2 for ; Fri, 11 Apr 2025 18:29:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4B18060739; Fri, 11 Apr 2025 18:29:49 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id NB2q9oDjcKke; Fri, 11 Apr 2025 18:29:48 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BECC560A6A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1744396188; bh=1wyzknAldsGeE8nxA+Wi2EM/kB1AbzfAUCjC1bwvqzQ=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=9iEb1TvGjDQOLZsN3zHKJQvguV5me0+Tafia/MUFEcx+bg3TlQaCNn0kgUVelh4Zv P/l9P2P6M2FPM9Kbm01ThCpsBxHxSwoGUX3jlFniDJAEQn/IwCm5bvffJ1RNlzKMBD lp8SXvsMZIS2deXFtim8SnPZgLUwAuhTF6lIcoHEESK6nXHfEpm3wqGlkp67bNJAM6 oOowpIyUdDFQRtrJFQ8+lIm3ur1+DNN1X11AQHCSoFfEOeCIIUnQQU4WASHP/GAhla Zw8c7CwUl8NYYyq8saSR3vtBz0RftizhWlvq9Gt4WDH2bRQMUD3yfZEDxmh5d9fsFo BVN0CgNbD+TRA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id BECC560A6A; Fri, 11 Apr 2025 18:29:48 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 022A1138 for ; Fri, 11 Apr 2025 18:29:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DD5D840284 for ; Fri, 11 Apr 2025 18:29:47 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id yNFDQsvxqgDr for ; Fri, 11 Apr 2025 18:29:47 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4F5B240851 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4F5B240851 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4F5B240851 for ; Fri, 11 Apr 2025 18:29:47 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 4FB1F614AD; Fri, 11 Apr 2025 18:29:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DFF1C4CEE2; Fri, 11 Apr 2025 18:29:42 +0000 (UTC) Date: Fri, 11 Apr 2025 19:29:40 +0100 From: Simon Horman To: Larysa Zaremba Cc: intel-wired-lan@lists.osuosl.org, Tony Nguyen , Michal Swiatkowski , Emil Tantilov , Madhu Chittim , Josh Hay , Michal Kubiak , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20250411182940.GO395307@horms.kernel.org> References: <20250410115225.59462-1-larysa.zaremba@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250410115225.59462-1-larysa.zaremba@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744396185; bh=CzoWDLggbQ35EU7dIhJdBlfGx2o0jRfrpK7rR1Z9fZY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kdz9gLQ08RPj3Ev2eETay9KKUOXvzU/POkFSrk+hBNhsrF8NVWFkca/PDU2u358Mu kRzOY5uZwDc6BzBqQketTIeae930n3LbBoW4aWvEDj3qIjshVGDixq/E1oaMu40D7s kTcJ2udErRjCndUWEFkEMbw/zwWOPyvHHOn2RGoRTdWT519ufqPpVjUUGkfVIFk8G5 nXf/dei6wMGKBkQ3OzCGqz+Kdim6As/PvSmPaCQY89qzjNj0JG7Ka8xLOsoZNAvxW7 z8rpPGBUF9YOpO7IU+myyjQ4BVz9mvJHWHpoA3DUnZqayvQx3KcrfZC36NOvi/bLqK t/4wADjdvafqA== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=kdz9gLQ0 Subject: Re: [Intel-wired-lan] [PATCH iwl-net] idpf: protect shutdown from reset X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Thu, Apr 10, 2025 at 01:52:23PM +0200, Larysa Zaremba wrote: > Before the referenced commit, the shutdown just called idpf_remove(), > this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task > rescheduling reset. Without this flag set the shutdown process is > vulnerable to HW reset or any other triggering conditions (such as > default mailbox being destroyed). > > When one of conditions checked in idpf_service_task becomes true, > vc_event_task can be rescheduled during shutdown, this leads to accessing > freed memory e.g. idpf_req_rel_vector_indexes() trying to read > vport->q_vector_idxs. This in turn causes the system to become defunct > during e.g. systemctl kexec. > > Considering using IDPF_REMOVE_IN_PROG would lead to more heavy shutdown > process, instead just cancel the serv_task before cancelling > adapter->serv_task before cancelling adapter->vc_event_task to ensure that > reset will not be scheduled while we are doing a shutdown. > > Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on reboot") > Reviewed-by: Michal Swiatkowski > Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E1C942367DC; Fri, 11 Apr 2025 18:29:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744396186; cv=none; b=u9/O64ubhBm3l5G//RYvUC4u2tVpyWveqfEqLktQYttG266775CinHXkFdMSvk1Uh/2Dg4MpgogVxV6ShrWPr1lslwMPDLsWDmR6LotUE7EzEEA2D47jrE8SQNLsM/Z7BmEOBzDJDVI7+h3FRjy4qikMbH3OCzGOrRfpZbj3/Mc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744396186; c=relaxed/simple; bh=CzoWDLggbQ35EU7dIhJdBlfGx2o0jRfrpK7rR1Z9fZY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fC6ZRHre1Y4rmvD6a93c2E1NyvEJ4xl28iz3dq88MQ4ZcB8WImRVxUM/Rui7xSlFr6aDVu4vgQLvG53vziF1+vU5WDVb8jtlHMnVXwKvAA6xy1j/2BLQHPGKqceZk2vxPh43m4VKA/be0eltE32pz3mKd4L3FUJ9o7AqNQsJBMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kdz9gLQ0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kdz9gLQ0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DFF1C4CEE2; Fri, 11 Apr 2025 18:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744396185; bh=CzoWDLggbQ35EU7dIhJdBlfGx2o0jRfrpK7rR1Z9fZY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kdz9gLQ08RPj3Ev2eETay9KKUOXvzU/POkFSrk+hBNhsrF8NVWFkca/PDU2u358Mu kRzOY5uZwDc6BzBqQketTIeae930n3LbBoW4aWvEDj3qIjshVGDixq/E1oaMu40D7s kTcJ2udErRjCndUWEFkEMbw/zwWOPyvHHOn2RGoRTdWT519ufqPpVjUUGkfVIFk8G5 nXf/dei6wMGKBkQ3OzCGqz+Kdim6As/PvSmPaCQY89qzjNj0JG7Ka8xLOsoZNAvxW7 z8rpPGBUF9YOpO7IU+myyjQ4BVz9mvJHWHpoA3DUnZqayvQx3KcrfZC36NOvi/bLqK t/4wADjdvafqA== Date: Fri, 11 Apr 2025 19:29:40 +0100 From: Simon Horman To: Larysa Zaremba Cc: intel-wired-lan@lists.osuosl.org, Tony Nguyen , Michal Swiatkowski , Emil Tantilov , Madhu Chittim , Josh Hay , Michal Kubiak , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH iwl-net] idpf: protect shutdown from reset Message-ID: <20250411182940.GO395307@horms.kernel.org> References: <20250410115225.59462-1-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250410115225.59462-1-larysa.zaremba@intel.com> On Thu, Apr 10, 2025 at 01:52:23PM +0200, Larysa Zaremba wrote: > Before the referenced commit, the shutdown just called idpf_remove(), > this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task > rescheduling reset. Without this flag set the shutdown process is > vulnerable to HW reset or any other triggering conditions (such as > default mailbox being destroyed). > > When one of conditions checked in idpf_service_task becomes true, > vc_event_task can be rescheduled during shutdown, this leads to accessing > freed memory e.g. idpf_req_rel_vector_indexes() trying to read > vport->q_vector_idxs. This in turn causes the system to become defunct > during e.g. systemctl kexec. > > Considering using IDPF_REMOVE_IN_PROG would lead to more heavy shutdown > process, instead just cancel the serv_task before cancelling > adapter->serv_task before cancelling adapter->vc_event_task to ensure that > reset will not be scheduled while we are doing a shutdown. > > Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on reboot") > Reviewed-by: Michal Swiatkowski > Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman