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 3113EC64EC4 for ; Sat, 4 Mar 2023 16:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbjCDQov (ORCPT ); Sat, 4 Mar 2023 11:44:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjCDQos (ORCPT ); Sat, 4 Mar 2023 11:44:48 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79291D91D; Sat, 4 Mar 2023 08:44:46 -0800 (PST) Received: from fpc (unknown [46.242.14.200]) by mail.ispras.ru (Postfix) with ESMTPSA id ABB2440D403D; Sat, 4 Mar 2023 16:44:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru ABB2440D403D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1677948281; bh=jcmKiCU0jmyrYOYrLrsgDPTx2wBsRzFp5MKu8c+hVHk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MI2jz4XJm/ZNcsUUaGrdbdx4bCXFTXbL33DvK+t+kS0jFyXByyzsS1XUHv25LChud R9NPq61ahRSYOLqHTVBXwnAAA0aFoyK1etUT3uRlzyrL5Mfc1ZpoOaETYZEJQfTTRf gKct0HMP7uyR6P3DoVXANen0l+VOQ3VZgvDQMTwQ= Date: Sat, 4 Mar 2023 19:44:36 +0300 From: Fedor Pchelkin To: Jakub Kicinski , Krzysztof Kozlowski Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Guenter Roeck , Martin Faltesek , Duoming Zhou , Samuel Ortiz , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org Subject: Re: [PATCH] nfc: fix memory leak of se_io context in nfc_genl_se_io Message-ID: <20230304164436.w57r7rwt26vnperl@fpc> References: <20230225105614.379382-1-pchelkin@ispras.ru> <20230227112359.6df702e3@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230227112359.6df702e3@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 27, 2023 at 11:23:59AM -0800, Jakub Kicinski wrote: > FWIW this patch has already been applied, please send the next changes > on top: > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=25ff6f8a5a3b8dc48e8abda6f013e8cc4b14ffea Okay. On Mon, Feb 27, 2023 at 11:08:54AM +0100, Krzysztof Kozlowski wrote: > kfree could be after device_unlock. Although se_io() will free it with > lock held, but error paths usually unwind everything in reverse order > LIFO, so first unlock then kfree. Then, based on our dicsussion with Krzysztof, I'll send the patch adjusting the order in the error path.