All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>,
	Filipe Manana <fdmanana@suse.com>,
	David Sterba <dsterba@suse.com>, Sasha Levin <sashal@kernel.org>,
	linux-btrfs@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 083/109] btrfs: tree-log: check btrfs_lookup_data_extent return value
Date: Thu,  9 Sep 2021 07:54:40 -0400	[thread overview]
Message-ID: <20210909115507.147917-83-sashal@kernel.org> (raw)
In-Reply-To: <20210909115507.147917-1-sashal@kernel.org>

From: Marcos Paulo de Souza <mpdesouza@suse.com>

[ Upstream commit 3736127a3aa805602b7a2ad60ec9cfce68065fbb ]

Function btrfs_lookup_data_extent calls btrfs_search_slot to verify if
the EXTENT_ITEM exists in the extent tree. btrfs_search_slot can return
values bellow zero if an error happened.

Function replay_one_extent currently checks if the search found
something (0 returned) and increments the reference, and if not, it
seems to evaluate as 'not found'.

Fix the condition by checking if the value was bellow zero and return
early.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/btrfs/tree-log.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 5412361d0c27..8ea4b3da85d1 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -719,7 +719,9 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
 			 */
 			ret = btrfs_lookup_data_extent(fs_info, ins.objectid,
 						ins.offset);
-			if (ret == 0) {
+			if (ret < 0) {
+				goto out;
+			} else if (ret == 0) {
 				btrfs_init_generic_ref(&ref,
 						BTRFS_ADD_DELAYED_REF,
 						ins.objectid, ins.offset, 0);
-- 
2.30.2


  parent reply	other threads:[~2021-09-09 12:56 UTC|newest]

Thread overview: 137+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 11:53 [PATCH AUTOSEL 5.4 001/109] drm/amdgpu: Fix amdgpu_ras_eeprom_init() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 002/109] ASoC: atmel: ATMEL drivers don't need HAS_DMA Sasha Levin
2021-09-09 11:53   ` Sasha Levin
2021-09-09 11:53   ` Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 003/109] media: dib8000: rewrite the init prbs logic Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 004/109] crypto: mxs-dcp - Use sg_mapping_iter to copy data Sasha Levin
2021-09-09 11:53   ` Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 005/109] PCI: Use pci_update_current_state() in pci_enable_device_flags() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 006/109] tipc: keep the skb in rcv queue until the whole data is read Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 007/109] iio: dac: ad5624r: Fix incorrect handling of an optional regulator Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 008/109] iavf: do not override the adapter state in the watchdog task Sasha Levin
2021-09-09 11:53   ` [Intel-wired-lan] " Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 009/109] iavf: fix locking of critical sections Sasha Levin
2021-09-09 11:53   ` [Intel-wired-lan] " Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 010/109] ARM: dts: qcom: apq8064: correct clock names Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 011/109] video: fbdev: kyro: fix a DoS bug by restricting user input Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 012/109] netlink: Deal with ESRCH error in nlmsg_notify() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 013/109] Smack: Fix wrong semantics in smk_access_entry() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 014/109] drm: avoid blocking in drm_clients_info's rcu section Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 015/109] igc: Check if num of q_vectors is smaller than max before array access Sasha Levin
2021-09-09 11:53   ` [Intel-wired-lan] " Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 016/109] usb: host: fotg210: fix the endpoint's transactional opportunities calculation Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 017/109] usb: host: fotg210: fix the actual_length of an iso packet Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 018/109] usb: gadget: u_ether: fix a potential null pointer dereference Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 019/109] USB: EHCI: ehci-mv: improve error handling in mv_ehci_enable() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 020/109] usb: gadget: composite: Allow bMaxPower=0 if self-powered Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 021/109] staging: board: Fix uninitialized spinlock when attaching genpd Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 022/109] tty: serial: jsm: hold port lock when reporting modem line changes Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 023/109] drm/amd/display: Fix timer_per_pixel unit error Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 024/109] spi: imx: fix ERR009165 Sasha Levin
2021-09-09 11:53   ` Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 025/109] drm/amd/amdgpu: Update debugfs link_settings output link_rate field in hex Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 026/109] bpf/tests: Fix copy-and-paste error in double word test Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 027/109] bpf/tests: Do not PASS tests without actually testing the result Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 028/109] video: fbdev: asiliantfb: Error out if 'pixclock' equals zero Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 029/109] video: fbdev: kyro: " Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 030/109] video: fbdev: riva: " Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 031/109] ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 032/109] flow_dissector: Fix out-of-bounds warnings Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 033/109] s390/jump_label: print real address in a case of a jump label bug Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 034/109] s390: make PCI mio support a machine flag Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 035/109] serial: 8250: Define RX trigger levels for OxSemi 950 devices Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 036/109] xtensa: ISS: don't panic in rs_init Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 037/109] hvsi: don't panic on tty_register_driver failure Sasha Levin
2021-09-09 11:53   ` Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 038/109] serial: 8250_pci: make setup_port() parameters explicitly unsigned Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 039/109] staging: ks7010: Fix the initialization of the 'sleep_status' structure Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 040/109] samples: bpf: Fix tracex7 error raised on the missing argument Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 041/109] ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init() Sasha Levin
2021-09-09 11:53 ` [PATCH AUTOSEL 5.4 042/109] i2c: i801: Fix handling SMBHSTCNT_PEC_EN Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 043/109] Bluetooth: skip invalid hci_sync_conn_complete_evt Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 044/109] workqueue: Fix possible memory leaks in wq_numa_init() Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 045/109] bonding: 3ad: fix the concurrency between __bond_release_one() and bond_3ad_state_machine_handler() Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 046/109] arm64: tegra: Fix Tegra194 PCIe EP compatible string Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 047/109] ASoC: Intel: bytcr_rt5640: Move "Platform Clock" routes to the maps for the matching in-/output Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 048/109] bpf: Fix off-by-one in tail call count limiting Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 049/109] media: imx258: Rectify mismatch of VTS value Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 050/109] media: imx258: Limit the max analogue gain to 480 Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 051/109] media: v4l2-dv-timings.c: fix wrong condition in two for-loops Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 052/109] media: TDA1997x: fix tda1997x_query_dv_timings() return value Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 053/109] media: tegra-cec: Handle errors of clk_prepare_enable() Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 054/109] ARM: dts: imx53-ppd: Fix ACHC entry Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 055/109] arm64: dts: qcom: sdm660: use reg value for memory node Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 056/109] net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 057/109] drm/msm: mdp4: drop vblank get/put from prepare/complete_commit Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 058/109] selftests/bpf: Fix xdp_tx.c prog section name Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 059/109] Bluetooth: schedule SCO timeouts with delayed_work Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 060/109] Bluetooth: avoid circular locks in sco_sock_connect Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 061/109] net/mlx5: Fix variable type to match 64bit Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 062/109] gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port() Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 063/109] drm/display: fix possible null-pointer dereference in dcn10_set_clock() Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 064/109] mac80211: Fix monitor MTU limit so that A-MSDUs get through Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 065/109] ARM: tegra: tamonten: Fix UART pad setting Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 066/109] arm64: tegra: Fix compatible string for Tegra132 CPUs Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 067/109] arm64: dts: ls1046a: fix eeprom entries Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 068/109] nvme-tcp: don't check blk_mq_tag_to_rq when receiving pdu data Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 069/109] ACPICA: iASL: Fix for WPBT table with no command-line arguments Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 070/109] Bluetooth: Fix handling of LE Enhanced Connection Complete Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 071/109] opp: Don't print an error if required-opps is missing Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 072/109] serial: sh-sci: fix break handling for sysrq Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 073/109] tcp: enable data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQD Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 074/109] rpc: fix gss_svc_init cleanup on failure Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 075/109] staging: rts5208: Fix get_ms_information() heap buffer size Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 076/109] gfs2: Don't call dlm after protocol is unmounted Sasha Levin
2021-09-09 11:54   ` [Cluster-devel] " Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 077/109] usb: chipidea: host: fix port index underflow and UBSAN complains Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 078/109] lockd: lockd server-side shouldn't set fl_ops Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 079/109] drm/exynos: Always initialize mapping in exynos_drm_register_dma() Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 080/109] m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-arch Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 081/109] btrfs: subpage: check if there are compressed extents inside one page Sasha Levin
2021-09-09 13:00   ` David Sterba
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 082/109] btrfs: subpage: fix race between prepare_pages() and btrfs_releasepage() Sasha Levin
2021-09-09 13:00   ` David Sterba
2021-09-09 11:54 ` Sasha Levin [this message]
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 084/109] ASoC: intel: atom: Revert PCM buffer address setup workaround again Sasha Levin
2021-09-09 12:06   ` Takashi Iwai
2021-09-09 12:06     ` Takashi Iwai
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 085/109] ASoC: Intel: Skylake: Fix module configuration for KPB and MIXER Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 086/109] ASoC: Intel: Skylake: Fix passing loadable flag for module Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 087/109] of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 088/109] mmc: sdhci-of-arasan: Check return value of non-void funtions Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 089/109] mmc: rtsx_pci: Fix long reads when clock is prescaled Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 090/109] selftests/bpf: Enlarge select() timeout for test_maps Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 091/109] mmc: core: Return correct emmc response in case of ioctl error Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 092/109] cifs: fix wrong release in sess_alloc_buffer() failed path Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 093/109] Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set" Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 094/109] usb: musb: musb_dsps: request_irq() after initializing musb Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 095/109] usbip: give back URBs for unsent unlink requests during cleanup Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 096/109] usbip:vhci_hcd USB port can get stuck in the disabled state Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 097/109] ASoC: rockchip: i2s: Fix regmap_ops hang Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 098/109] ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54   ` Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 099/109] drm/amdkfd: Account for SH/SE count when setting up cu masks Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 100/109] iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 101/109] iwlwifi: mvm: avoid static queue number aliasing Sasha Levin
2021-09-09 11:54 ` [PATCH AUTOSEL 5.4 102/109] iwlwifi: mvm: fix access to BSS elements Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 103/109] net/mlx5: DR, Enable QP retransmission Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 104/109] parport: remove non-zero check on count Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 105/109] ath9k: fix OOB read ar9300_eeprom_restore_internal Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 106/109] ath9k: fix sleeping in atomic context Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 107/109] net: fix NULL pointer reference in cipso_v4_doi_free Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 108/109] fix array-index-out-of-bounds in taprio_change Sasha Levin
2021-09-09 11:55 ` [PATCH AUTOSEL 5.4 109/109] net: w5100: check return value after calling platform_get_resource() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210909115507.147917-83-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpdesouza@suse.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.