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 1461AC61DA4 for ; Tue, 14 Feb 2023 14:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbjBNORg (ORCPT ); Tue, 14 Feb 2023 09:17:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbjBNORd (ORCPT ); Tue, 14 Feb 2023 09:17:33 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6095A24C8F for ; Tue, 14 Feb 2023 06:17:08 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id E406867373; Tue, 14 Feb 2023 15:10:47 +0100 (CET) Date: Tue, 14 Feb 2023 15:10:47 +0100 From: Christoph Hellwig To: Harshit Mogalapalli Cc: harshit.m.mogalapalli@gmail.com, error27@gmail.com, hch@lst.de, Richard Weinberger , Miquel Raynal , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH linux-next] ubi: block: Fix a possible use-after-free bug in ubiblock_create() Message-ID: <20230214141047.GA13930@lst.de> References: <20230214093801.1267044-1-harshit.m.mogalapalli@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230214093801.1267044-1-harshit.m.mogalapalli@oracle.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 14, 2023 at 01:38:01AM -0800, Harshit Mogalapalli wrote: > Smatch warns: > drivers/mtd/ubi/block.c:438 ubiblock_create() > warn: '&dev->list' not removed from list > > 'dev' is freed in 'out_free_dev:, but it is still on the list. > > To fix this, delete the list item before freeing. > > Fixes: 91cc8fbcc8c7 ("ubi: block: set BLK_MQ_F_BLOCKING") > Signed-off-by: Harshit Mogalapalli Thanks, this looks good: Reviewed-by: Christoph Hellwig