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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (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 9FF67C47DDB for ; Mon, 29 Jan 2024 10:28:01 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rUOrv-00032S-TG; Mon, 29 Jan 2024 10:28:00 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rUOru-00032M-FW for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Jan 2024 10:27:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NoBtbWBG+b1qUxuU3QxEjVwcHZileZtHD/xiFangzVk=; b=Ivq0P7vaAHx4RWhzU1ylUT4iD6 VxwNU84PRZDtsMkO4zoJC2Xb9/JIezyRCgxgsgQuib1G6ZWim4Sznqqs1cwfjhksv2aKQPKp0rD9R 8tPR2kp2Y0iMK3G38N52uLjUBoTMNxzT36Nyc9AULi+mheuhw6cnQiZC+JEIkscugcbs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NoBtbWBG+b1qUxuU3QxEjVwcHZileZtHD/xiFangzVk=; b=GyQG/hXifI/vPdf6l/aMeQGd5a c+VwD2kr0oSMtDeF6+cc9k9QDm2B9FCwkS+ilCVMlthqtIFUtWYVuxtqHXYdpYFA1S5MqGGykTcy6 AcNLj2hVlgQGr9b822c9wwgALIPVgeHl7YysF0kMPwkMj8DBimpo7env5otPKjubWCpA=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rUOrr-0005Vh-Ho for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Jan 2024 10:27:59 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CA6C362046; Mon, 29 Jan 2024 10:27:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01ABAC43390; Mon, 29 Jan 2024 10:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706524065; bh=dJ3bS5oGG9PHms+736cFAZX/JO0z5fQy3JzWxPCMyqc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=qJ6H4eTWCM1WSFpRsizOIHNUQefYGhckq73mSh80dT/GCCrPohIBd/BZx+8MvPhsX Ue74dpfnWa2meEEYCbKyugyVLUwDszjvrJfgtp4xHfD+aJKlnLvJfoniYMMgtADO73 xk/810eY/grQ3XUkPY2G9WwTiUUj88VXkgV7eIPIv8jh6xGy7yQ1+M3HutW8fLndsw 9YymWyTvOywHyNpTmJg8Q4rDBojS0F5cf+Vbci4SgNQ8cX28DwvIMrhTl73M+wjY0C u5nU48uBa/pfIs405Q7rL+akEn86Tv3WUQybJ0IGJqff2yPfevc/Ms2eKbzT2Tjslo qHoxhRyLbmBkA== Message-ID: Date: Mon, 29 Jan 2024 18:27:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Wenjie Qi , jaegeuk@kernel.org References: <20240116141138.1245-1-qwjhust@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20240116141138.1245-1-qwjhust@gmail.com> X-Headers-End: 1rUOrr-0005Vh-Ho Subject: Re: [f2fs-dev] [PATCH v1] f2fs: fix NULL pointer dereference in f2fs_submit_page_write() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, hustqwj@hust.edu.cn, linux-f2fs-devel@lists.sourceforge.net Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 2024/1/16 22:11, Wenjie Qi wrote: > BUG: kernel NULL pointer dereference, address: 0000000000000014 > RIP: 0010:f2fs_submit_page_write+0x6cf/0x780 [f2fs] > Call Trace: > > ? show_regs+0x6e/0x80 > ? __die+0x29/0x70 > ? page_fault_oops+0x154/0x4a0 > ? prb_read_valid+0x20/0x30 > ? __irq_work_queue_local+0x39/0xd0 > ? irq_work_queue+0x36/0x70 > ? do_user_addr_fault+0x314/0x6c0 > ? exc_page_fault+0x7d/0x190 > ? asm_exc_page_fault+0x2b/0x30 > ? f2fs_submit_page_write+0x6cf/0x780 [f2fs] > ? f2fs_submit_page_write+0x736/0x780 [f2fs] > do_write_page+0x50/0x170 [f2fs] > f2fs_outplace_write_data+0x61/0xb0 [f2fs] > f2fs_do_write_data_page+0x3f8/0x660 [f2fs] > f2fs_write_single_data_page+0x5bb/0x7a0 [f2fs] > f2fs_write_cache_pages+0x3da/0xbe0 [f2fs] > ... > It is possible that other threads have added this fio to io->bio > and submitted the io->bio before entering f2fs_submit_page_write(). > At this point io->bio = NULL. > If is_end_zone_blkaddr(sbi, fio->new_blkaddr) of this fio is true, > then an NULL pointer dereference error occurs at bio_get(io->bio). > The original code for determining zone end was after "out:", > which would have missed some fio who is zone end. I've moved > this code before "skip:" to make sure it's done for each fio. > > Signed-off-by: Wenjie Qi Reviewed-by: Chao Yu Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel