Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2052139lqo; Mon, 13 May 2024 06:42:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSIQY+x1vAq69rvWbjfqEfXwqVMgUajZ2IWPGgqLlbuqRpYZ291fRrT6ybMtRr3upOGJHxLcnpyXTO7MyjgWbHzrT40qYSz9/S7iXtPg== X-Google-Smtp-Source: AGHT+IHkVJpE6VfxrkJynYTiaK5zuEPg+5UTVzHttjedbFmyI/e1wL/k8zkUM2YP3ne03u1F0wKo X-Received: by 2002:a05:6808:8f4:b0:3c8:6543:584b with SMTP id 5614622812f47-3c9970d19a0mr11063310b6e.54.1715607749952; Mon, 13 May 2024 06:42:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715607749; cv=pass; d=google.com; s=arc-20160816; b=r7smYQt8c9DDFIfMt315u/Qw0WYNb9S0sb0JlJzBYqbGL4hIF5L5JtklxHyulukiKs QjgXWKpxp3pFIF3NTsvDFHM9VpFU7CXpN4XvPc1r4zVIT6zrcsGWuGdf5Jpxvnuf+uRR 52Vx+fZ3a1bDDIW7ZikQA4qfTqNoVZsWVw3NMH0ZgZyBjUsISv3fo/LWYDVUns9VvLps Pm3Jr/SZ1UPvyn23yS51dGnoLR/nhqarI1mqHmt2mT5bvD19gG6v7XybXY446YpmFkL2 ls59Db0TPW2lWUvK6mjGvQsEWDj/bWNLgwC9pC21mUBsCODiXe+7u3qyORQBjK88EQ62 /K3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=Kd4DRq9qVstTu8IM1frFe8wCSYGv4REY+hKqbmhP4w4=; fh=Yf8KxdvJj8sY/Bpxw4ThLi2J4FGkot3tSZ5JKsahmyk=; b=TD3mpj3gJHtCaYeifcFZr/pd22/imStH65WVZA/zltAi/hwrgRnqIT2nb1fnJLLYPt RXuTgAYUaNVxanfQIxHt7ysk2iSGisUaCTiqx4K/C6ywCH9iCWgSnI6l7l5MRgTJHXdW inBk1UCk/P5XJKjktXN8SK/jaleJtjF7+A06Gs38rGrrObeB7PEvIrJ8X4ZrjB7lYw8a nIk1LSnCRF2eLK1QIdeJ3XxT+z88kuSWTvn4klFJ6TITGVv4P0uCJ43BGCPp0Rkoq1Tu oBva0apQURsloXzfbpOne0Kn/fIZomaBRZeGHyn7MnW7FeVuvKAy5yGtTEY6A15n0KLb kurA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0QC3sOm4; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0QC3sOm4; dkim=neutral (no key) header.i=@suse.cz; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-177634-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177634-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29a2ffsi99082496d6.190.2024.05.13.06.42.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 06:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177634-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0QC3sOm4; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=0QC3sOm4; dkim=neutral (no key) header.i=@suse.cz; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-177634-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177634-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 40ED71C22F67 for ; Mon, 13 May 2024 13:42:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 988BB1534EE; Mon, 13 May 2024 13:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="0QC3sOm4"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="S42fgk9+"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="0QC3sOm4"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="S42fgk9+" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF6A6153500; Mon, 13 May 2024 13:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715607697; cv=none; b=SaiokIV1blbYOU+ug78IEqHG16IqT00xVc571mhnzWl8F3hCcEIV8LF+BrIBEDJbnHx0jdWi4+RraPh8KskvecJQ/M6dE5mCFZVsSCEodK0XMNMoBtzDrm3ZvInNz9nWuIr92rDu1UpY5uYdCDfjYJMVQ7Rzeq3zxss/77wJGgg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715607697; c=relaxed/simple; bh=trheXddaiEdfLrELnD3wTUNe0KrBMDYC+vggIcIMqB4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=By2nhmMdKp78e/7ffjmAQsb+UNyfR5crOmTiHuj6ZkaOTdbSGkM/Tr0QiNQszf/w0irhiAjOwBXROW3NP2c+y3bCfveYZ6x8ueFLJfKp+HjKRhKxoD3u0mKK5wdm8HD+nnxByjNPduMGVnkm9RtNwHefrCBU8X/U5fvrlEMettI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=0QC3sOm4; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=S42fgk9+; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=0QC3sOm4; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=S42fgk9+; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 47CDD34A04; Mon, 13 May 2024 13:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1715607694; 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=Kd4DRq9qVstTu8IM1frFe8wCSYGv4REY+hKqbmhP4w4=; b=0QC3sOm4rPnX9/xHC5xPWMpa7h9PVI2tC2nTEbzHwLbjbn1Q+IDy9jBm4/ph7H7ihbI2T8 WFLNP4usSduDAoGHS82NNF7KGOJ+myDAXs64VgKHdWSssg//fWqythsK0y7cLwmzxDOFnd Qk1043UChA7jYSmzwLWqKV9/hY7mF8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1715607694; 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=Kd4DRq9qVstTu8IM1frFe8wCSYGv4REY+hKqbmhP4w4=; b=S42fgk9+CR7qj0VQ6zjDgKNlLAs1BEoJjxZNlEhVfao6DeD9mqN4zvTYx140r/dqaIsXQ3 0pa6bL0yMD9pd2BQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=0QC3sOm4; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=S42fgk9+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1715607694; 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=Kd4DRq9qVstTu8IM1frFe8wCSYGv4REY+hKqbmhP4w4=; b=0QC3sOm4rPnX9/xHC5xPWMpa7h9PVI2tC2nTEbzHwLbjbn1Q+IDy9jBm4/ph7H7ihbI2T8 WFLNP4usSduDAoGHS82NNF7KGOJ+myDAXs64VgKHdWSssg//fWqythsK0y7cLwmzxDOFnd Qk1043UChA7jYSmzwLWqKV9/hY7mF8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1715607694; 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=Kd4DRq9qVstTu8IM1frFe8wCSYGv4REY+hKqbmhP4w4=; b=S42fgk9+CR7qj0VQ6zjDgKNlLAs1BEoJjxZNlEhVfao6DeD9mqN4zvTYx140r/dqaIsXQ3 0pa6bL0yMD9pd2BQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0D15A13A5D; Mon, 13 May 2024 13:41:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oa0nA44YQmYcDwAAD6G6ig (envelope-from ); Mon, 13 May 2024 13:41:34 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 09ABFA08BF; Sun, 12 May 2024 12:09:31 +0200 (CEST) Date: Sun, 12 May 2024 12:09:30 +0200 From: Jan Kara To: Kemeng Shi Cc: tytso@mit.edu, jack@suse.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/9] jbd2: avoid memleak in jbd2_journal_write_metadata_buffer Message-ID: <20240512100930.7p5pylbazn5etw7k@quack3> References: <20240506141801.1165315-1-shikemeng@huaweicloud.com> <20240506141801.1165315-2-shikemeng@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240506141801.1165315-2-shikemeng@huaweicloud.com> X-Spam-Flag: NO X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: 47CDD34A04 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; DATE_IN_PAST(1.00)[27]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MISSING_XM_UA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_THREE(0.00)[3]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email,suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+] On Mon 06-05-24 22:17:53, Kemeng Shi wrote: > The new_bh is from alloc_buffer_head, we should call free_buffer_head to > free it in error case. > > Signed-off-by: Kemeng Shi Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/jbd2/journal.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c > index b6c114c11b97..207b24e12ce9 100644 > --- a/fs/jbd2/journal.c > +++ b/fs/jbd2/journal.c > @@ -399,6 +399,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction, > tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS); > if (!tmp) { > brelse(new_bh); > + free_buffer_head(new_bh); > return -ENOMEM; > } > spin_lock(&jh_in->b_state_lock); > -- > 2.30.0 > -- Jan Kara SUSE Labs, CR