Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp368783rdf; Tue, 21 Nov 2023 05:12:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmE+7yrR3GfWz9XgdEwx1QUY2GrOGVbVGhSwPPWd5Sl9ftKlFak8B+B5cPItr+kT8zdRwd X-Received: by 2002:a05:6870:610e:b0:1f9:3b11:334d with SMTP id s14-20020a056870610e00b001f93b11334dmr7331849oae.22.1700572357571; Tue, 21 Nov 2023 05:12:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700572357; cv=none; d=google.com; s=arc-20160816; b=khUYnJfLL0rRHG99xNRnzS3AVBqilOlqlu8rnAXCOMcBYXkaiXuIRGk/euHnDMrOdU wk/7W3TFcsn1F9m3v9XppiWAZohY+Gj0HR4WFaRaQzCozAEgcTHCMxMr/1DiKpbm66S2 0cTnyoIDYPNBN7GMgAH2KFfDWt1y4bHoF+NI9OSdtppes2Y1bIcmPMEDMgtPGF82HoMl xMMW3r5YNvElX3dtJ6omb/679Ut0qcEVB8nyjILKAV6Jy9a0plBiiAk2RrRzKmyWpUd7 Gaz883nm+Tv2Ra7pkVIBpgGVJroGq/MBVWbx4LCDON+ShhDz+whqwUIlZDFc3WP1IRVH JxIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=hqg8B1Cfy6FxrdAzeN1cVHxxKFT4Kxba9fydGibvXb4=; fh=CUOt25BhW5auiUtxg4Wj3gxukW+hYwlEh8jmOfDJ9S8=; b=KHJkzoUYTHfvQKQbVWUOMjIL+8CAk4e6//XxSnBBc5UhD4oYYj0n7F42TVDZafwCi0 IPk72Co5NLgGFzooZljC3LhDy1wGXiZ2z4CQywsi3d1kKi6GT93U/mipxnqkW244Jlba mH5hOcBkfBzANUz5SAtidhoVoUunwxOdgcw4jNmYJF5B2SLEmyzgc6/OsjIM+0Qn+FeM wHeBdArewbZQLw6vGwBpngORnbzo1t7mcFncSlXj2MLkPXD2ynVAqpI9dSmPF3rFZAJ2 TKl7/WtE5OvqCD8Fs0sdyqHSKNEbg3SfbBUUuZPq5IT9Y9+8MxjewClvGOtyYD6xOsqo xkKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=sm7PREpT; 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 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z9-20020a056870e30900b001f5ece5f058si2057808oad.187.2023.11.21.05.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 05:12:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=sm7PREpT; 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 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id F021C807C85A; Tue, 21 Nov 2023 05:10:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233840AbjKUNKa (ORCPT + 99 others); Tue, 21 Nov 2023 08:10:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbjKUNK3 (ORCPT ); Tue, 21 Nov 2023 08:10:29 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C17797; Tue, 21 Nov 2023 05:10:26 -0800 (PST) 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 9097E21961; Tue, 21 Nov 2023 13:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1700572224; h=from:from:reply-to: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=hqg8B1Cfy6FxrdAzeN1cVHxxKFT4Kxba9fydGibvXb4=; b=sm7PREpTMHoagXGVOOeISV/D770oLS3kztQsSBml/7ohykRkHkXh582U1IR4J+SBWUVZkV 7KpJrhMA9NmN1ZlD1DemUrePdmXkpE3sNp9Zdjqc9g0484i9EYwdT7tfBG5Ch8nAYrDlBe QnriHgQtiJ5HQV2DG9b3r/FOeGYA4uE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1700572224; h=from:from:reply-to: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=hqg8B1Cfy6FxrdAzeN1cVHxxKFT4Kxba9fydGibvXb4=; b=QEx1iHNikLdHtI8E5AooFBcr6KffnYEX8Xr1S0JYdb7QRjjU1URfKUJLR9xeuEUo96RxIw HnA74SfUlbZs7UDQ== 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 5D757139FD; Tue, 21 Nov 2023 13:10:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id bkcGFkCsXGXYJwAAMHmgww (envelope-from ); Tue, 21 Nov 2023 13:10:24 +0000 Date: Tue, 21 Nov 2023 14:03:15 +0100 From: David Sterba To: Bragatheswaran Manickavel Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+d66de4cbf532749df35f@syzkaller.appspotmail.com Subject: Re: [PATCH v2] btrfs: ref-verify: fix memory leaks Message-ID: <20231121130315.GP11264@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20231118091012.14818-1-bragathemanick0908@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231118091012.14818-1-bragathemanick0908@gmail.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 3.64 X-Spamd-Result: default: False [3.64 / 50.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.30)[dsterba@suse.cz]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[d66de4cbf532749df35f]; REPLYTO_ADDR_EQ_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.06)[60.70%]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_SPAM_SHORT(3.00)[1.000]; FREEMAIL_TO(0.00)[gmail.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 05:10:40 -0800 (PST) On Sat, Nov 18, 2023 at 02:40:12PM +0530, Bragatheswaran Manickavel wrote: > In btrfs_ref_tree_mod(), when !parent 're' was allocated > through kmalloc(). In the following code, if an error occurs, > the execution will be redirected to 'out' or 'out_unlock' and > the function will be exited. However, on some of the paths, > 're' are not deallocated and may lead to memory leaks. > > For example : lookup_block_entry() for 'be' returns null, the > out label will be invoked. During that flow ref and ra was > freed but not re, which can potentially lead to memleak > > Reported-and-tested-by: syzbot+d66de4cbf532749df35f@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=d66de4cbf532749df35f > Signed-off-by: Bragatheswaran Manickavel Added to misc-next, thanks.