Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1791016rdb; Mon, 9 Oct 2023 03:08:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtl0xHI85RKetWoVQNDkzJuD4sBukbtNBPOM4eezqTdIGLo0Fo6Vkcl4qJLYjgL9IbcBnt X-Received: by 2002:a17:902:9a01:b0:1c1:f0b4:f68f with SMTP id v1-20020a1709029a0100b001c1f0b4f68fmr13527347plp.10.1696846128203; Mon, 09 Oct 2023 03:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696846128; cv=none; d=google.com; s=arc-20160816; b=GlXlLN1JneuCAefVfeKyEYtNiGMYRgxbpGJF6bxoeiwOjiVCdO4kustxvvUmDCHFjI L/julDeW1ULDiUTs0+xKRPx7ANusfytGRMhF1frHUV/jHrW5Q7Xrc/H7qcueFm6OsBi2 GngjrjV/iCC6zbeJu1eZW7DOa5PDVL53GhRcBtqBSSbbRAHpBTNfVfbBhbuKWbZ9C1ws 44FZ314aSLOG3xAfRMKqQnuf5qBmhn1NvDEcLD36Rh6qkSF7ld0Qkivte8OK4XMb/4hS /3WIQAXgOA8H69/18De9yIuuOcMgFQHiLzRosljyjzCA0CG1g621AgqLmqIOYOUbi/OU Km+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=KI8iGmDacbjyfpujQS0BFEqs/bpz2R47Nq98pWnN1Kg=; fh=ywXKYYX2PiFkaX0EXpZqrNlCGn51LditM4GEx9EYxmg=; b=W1YJJMOarLu2RFiR/aIRpJ0rjY661SUhCgVDd+FVa1nPoIe+eAbm5mmK6nHs95JxDI RWj3h3sMQY61TK5tgFJ3+c17hhPAvPyWKzA2eu4IbxJmT1JAGIoXG4q771pm92Zqnm6D sZCSWKVQsdFwmJyvslLfUiH20bSiJoBv2VmZJ4dh9wZLtlKLYFUNVNbdyShOt+TtuSyL i9Tx0FjrCLBDF7ricYihfF0n9IlflgrKSwbrUFrEObu4kGh5x1CBKicapII6geYTUiO/ U+nlOkxh+fwJHRvr3OrqAjaCdIHUJK7Vrszu6wKW5OYx8jhBx9R+zYtZfhqJWqjf+YRD yeQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kLdsgi8i; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x11-20020a17090300cb00b001bb23874273si3249112plc.220.2023.10.09.03.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:08:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kLdsgi8i; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CF04C80B8DC6; Mon, 9 Oct 2023 03:08:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346080AbjJIKIb (ORCPT + 99 others); Mon, 9 Oct 2023 06:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346048AbjJIKI2 (ORCPT ); Mon, 9 Oct 2023 06:08:28 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE9297; Mon, 9 Oct 2023 03:08:27 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 18EE421847; Mon, 9 Oct 2023 10:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1696846106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KI8iGmDacbjyfpujQS0BFEqs/bpz2R47Nq98pWnN1Kg=; b=kLdsgi8ijKHDs7ueTrlwHESoADuAyKkXPOBTNwBbQdKHrIzCOAZY6lro9s2/pv6+f5QqQg +xBHbSs2QyDGx3z+s4/R9INchqMqHlLs0myYWnOwJzZ4GQ1LJSCIELKjXaaRbMcaRpHkku 1fc1gKrlUleAhXjt3lZ6s/3uq6EyNT8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1696846106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KI8iGmDacbjyfpujQS0BFEqs/bpz2R47Nq98pWnN1Kg=; b=Ezey8VTIiHbqUPl9cBkACsMHidTrypgIsvLLrLo1GXWsO+A+pyht3ciFWhBNDIN4wEAUnN OQ3sn7AuaxPnIyDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 072C313905; Mon, 9 Oct 2023 10:08:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5aG1ARrRI2XpdQAAMHmgww (envelope-from ); Mon, 09 Oct 2023 10:08:26 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 94439A04B2; Mon, 9 Oct 2023 12:08:25 +0200 (CEST) Date: Mon, 9 Oct 2023 12:08:25 +0200 From: Jan Kara To: Lizhi Xu Cc: syzbot+23bc20037854bb335d59@syzkaller.appspotmail.com, axboe@kernel.dk, brauner@kernel.org, dave.kleikamp@oracle.com, hare@suse.de, hch@lst.de, jack@suse.cz, jfs-discussion@lists.sourceforge.net, johannes.thumshirn@wdc.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, shaggy@kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] jfs: fix log->bdev_handle null ptr deref in lbmStartIO Message-ID: <20231009100825.dkkaylsrj4db3ekp@quack3> References: <0000000000005239cf060727d3f6@google.com> <20231009094557.1398920-1-lizhi.xu@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009094557.1398920-1-lizhi.xu@windriver.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 03:08:46 -0700 (PDT) X-Spam-Level: ** On Mon 09-10-23 17:45:57, Lizhi Xu wrote: > When sbi->flag is JFS_NOINTEGRITY in lmLogOpen(), log->bdev_handle can't > be inited, so it value will be NULL. > Therefore, add the "log ->no_integrity=1" judgment in lbmStartIO() to avoid such > problems. > > Reported-and-tested-by: syzbot+23bc20037854bb335d59@syzkaller.appspotmail.com > Signed-off-by: Lizhi Xu Ah, good catch. Who would think someone creates bios for NULL bdev only to release them shortly afterwards ;). Anyway the fix looks good. Feel free to add: Reviewed-by: Jan Kara Christian, please pick up this fixup into your tree. Thanks! Honza > --- > fs/jfs/jfs_logmgr.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c > index c911d838b8ec..c41a76164f84 100644 > --- a/fs/jfs/jfs_logmgr.c > +++ b/fs/jfs/jfs_logmgr.c > @@ -2110,10 +2110,14 @@ static void lbmStartIO(struct lbuf * bp) > { > struct bio *bio; > struct jfs_log *log = bp->l_log; > + struct block_device *bdev = NULL; > > jfs_info("lbmStartIO"); > > - bio = bio_alloc(log->bdev_handle->bdev, 1, REQ_OP_WRITE | REQ_SYNC, > + if (!log->no_integrity) > + bdev = log->bdev_handle->bdev; > + > + bio = bio_alloc(bdev, 1, REQ_OP_WRITE | REQ_SYNC, > GFP_NOFS); > bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); > __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); > -- > 2.25.1 > -- Jan Kara SUSE Labs, CR