stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	syzbot+4acc7d910e617b360859@syzkaller.appspotmail.com,
	Theodore Tso <tytso@mit.edu>,
	"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15 092/107] ext4: drop the call to ext4_error() from ext4_get_group_info()
Date: Mon, 19 Jun 2023 12:31:16 +0200	[thread overview]
Message-ID: <20230619102145.769027998@linuxfoundation.org> (raw)
In-Reply-To: <20230619102141.541044823@linuxfoundation.org>

From: Fabio M. De Francesco <fmdefrancesco@gmail.com>

[ Upstream commit f451fd97dd2b78f286379203a47d9d295c467255 ]

A recent patch added a call to ext4_error() which is problematic since
some callers of the ext4_get_group_info() function may be holding a
spinlock, whereas ext4_error() must never be called in atomic context.

This triggered a report from Syzbot: "BUG: sleeping function called from
invalid context in ext4_update_super" (see the link below).

Therefore, drop the call to ext4_error() from ext4_get_group_info(). In
the meantime use eight characters tabs instead of nine characters ones.

Reported-by: syzbot+4acc7d910e617b360859@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/00000000000070575805fdc6cdb2@google.com/
Fixes: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
Suggested-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20230614100446.14337-1-fmdefrancesco@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ext4/balloc.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index fadcb94e80fa1..7649376fd93d3 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -322,17 +322,15 @@ static ext4_fsblk_t ext4_valid_block_bitmap_padding(struct super_block *sb,
 struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
 					    ext4_group_t group)
 {
-	 struct ext4_group_info **grp_info;
-	 long indexv, indexh;
-
-	 if (unlikely(group >= EXT4_SB(sb)->s_groups_count)) {
-		 ext4_error(sb, "invalid group %u", group);
-		 return NULL;
-	 }
-	 indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
-	 indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
-	 grp_info = sbi_array_rcu_deref(EXT4_SB(sb), s_group_info, indexv);
-	 return grp_info[indexh];
+	struct ext4_group_info **grp_info;
+	long indexv, indexh;
+
+	if (unlikely(group >= EXT4_SB(sb)->s_groups_count))
+		return NULL;
+	indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
+	indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
+	grp_info = sbi_array_rcu_deref(EXT4_SB(sb), s_group_info, indexv);
+	return grp_info[indexh];
 }
 
 /*
-- 
2.39.2




  parent reply	other threads:[~2023-06-19 11:03 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 10:29 [PATCH 5.15 000/107] 5.15.118-rc1 review Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 001/107] test_firmware: Use kstrtobool() instead of strtobool() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 002/107] test_firmware: prevent race conditions by a correct implementation of locking Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 003/107] test_firmware: fix a memory leak with reqs buffer Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 004/107] ksmbd: fix slab-out-of-bounds read in smb2_handle_negotiate Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 005/107] drm/amdgpu: fix Null pointer dereference error in amdgpu_device_recover_vram Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 006/107] of: overlay: rename variables to be consistent Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 007/107] of: overlay: rework overlay apply and remove kfree()s Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 008/107] of: overlay: Fix missing of_node_put() in error case of init_overlay_changeset() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 009/107] power: supply: ab8500: Fix external_power_changed race Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 010/107] power: supply: sc27xx: " Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 011/107] power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() + schedule() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 012/107] ARM: dts: vexpress: add missing cache properties Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 013/107] tools: gpio: fix debounce_period_us output of lsgpio Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 014/107] power: supply: Ratelimit no data debug output Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 5.15 015/107] platform/x86: asus-wmi: Ignore WMI events with codes 0x7B, 0xC0 Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 016/107] regulator: Fix error checking for debugfs_create_dir Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 017/107] irqchip/gic-v3: Disable pseudo NMIs on Mediatek devices w/ firmware issues Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 018/107] power: supply: Fix logic checking if system is running from battery Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 019/107] btrfs: scrub: try harder to mark RAID56 block groups read-only Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 020/107] btrfs: handle memory allocation failure in btrfs_csum_one_bio Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 021/107] ASoC: soc-pcm: test if a BE can be prepared Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 022/107] parisc: Improve cache flushing for PCXL in arch_sync_dma_for_cpu() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 023/107] parisc: Flush gatt writes and adjust gatt mask in parisc_agp_mask_memory() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 024/107] MIPS: unhide PATA_PLATFORM Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 025/107] MIPS: Alchemy: fix dbdma2 Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 026/107] mips: Move initrd_start check after initrd address sanitisation Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 027/107] ASoC: dwc: move DMA init to snd_soc_dai_driver probe() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 028/107] xen/blkfront: Only check REQ_FUA for writes Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 029/107] drm:amd:amdgpu: Fix missing buffer object unlock in failure path Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 030/107] NVMe: Add MAXIO 1602 to bogus nid list Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 031/107] irqchip/gic: Correctly validate OF quirk descriptors Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 032/107] io_uring: hold uring mutex around poll removal Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 033/107] wifi: cfg80211: fix locking in regulatory disconnect Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 034/107] wifi: cfg80211: fix double lock bug in reg_wdev_chan_valid() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 035/107] epoll: ep_autoremove_wake_function should use list_del_init_careful Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 036/107] ocfs2: fix use-after-free when unmounting read-only filesystem Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 037/107] ocfs2: check new file size on fallocate call Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 038/107] nios2: dts: Fix tse_mac "max-frame-size" property Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 039/107] nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 040/107] nilfs2: fix possible out-of-bounds segment allocation in resize ioctl Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 041/107] kexec: support purgatories with .text.hot sections Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 042/107] x86/purgatory: remove PGO flags Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 043/107] powerpc/purgatory: " Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 044/107] ALSA: usb-audio: Add quirk flag for HEM devices to enable native DSD playback Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 045/107] dm thin metadata: check fail_io before using data_sm Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 046/107] nouveau: fix client work fence deletion race Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 047/107] RDMA/uverbs: Restrict usage of privileged QKEYs Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 048/107] net: usb: qmi_wwan: add support for Compal RXM-G1 Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 049/107] drm/amd/display: edp do not add non-edid timings Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 050/107] drm/amdgpu: add missing radeon secondary PCI ID Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 051/107] ALSA: hda/realtek: Add a quirk for Compaq N14JP6 Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 052/107] Remove DECnet support from kernel Greg Kroah-Hartman
2023-09-11 13:47   ` Donald Buczek
2023-09-11 13:54     ` Greg Kroah-Hartman
2023-09-12  7:47       ` Donald Buczek
2023-09-12  8:15         ` Greg Kroah-Hartman
2023-09-13  7:40           ` Donald Buczek
2023-09-13  7:50             ` Greg Kroah-Hartman
2023-09-13  7:42           ` [PATCH 5.15 052/107] Remove DECnet support from kernelail Stephen Hemminger
2023-06-19 10:30 ` [PATCH 5.15 053/107] thunderbolt: dma_test: Use correct value for absent rings when creating paths Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 054/107] thunderbolt: Mask ring interrupt on Intel hardware as well Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 055/107] USB: serial: option: add Quectel EM061KGL series Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 056/107] serial: lantiq: add missing interrupt ack Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 057/107] usb: dwc3: gadget: Reset num TRBs before giving back the request Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 058/107] RDMA/rtrs: Fix the last iu->buf leak in err path Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 059/107] RDMA/rtrs: Fix rxe_dealloc_pd warning Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 060/107] RDMA/rxe: Fix packet length checks Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 061/107] spi: fsl-dspi: avoid SCK glitches with continuous transfers Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 062/107] netfilter: nf_tables: integrate pipapo into commit protocol Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 063/107] netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 064/107] netfilter: nf_tables: incorrect error path handling with NFT_MSG_NEWRULE Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 065/107] net: enetc: correct the indexes of highest and 2nd highest TCs Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 066/107] ping6: Fix send to link-local addresses with VRF Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 067/107] net/sched: simplify tcf_pedit_act Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 068/107] net/sched: act_pedit: remove extra check for key type Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 069/107] net/sched: act_pedit: Parse L3 Header for L4 offset Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 070/107] net/sched: cls_u32: Fix reference counter leak leading to overflow Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 071/107] RDMA/rxe: Remove the unused variable obj Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 072/107] RDMA/rxe: Removed unused name from rxe_task struct Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 073/107] RDMA/rxe: Fix the use-before-initialization error of resp_pkts Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 074/107] iavf: remove mask from iavf_irq_enable_queues() Greg Kroah-Hartman
2023-06-19 10:30 ` [PATCH 5.15 075/107] octeontx2-af: fixed resource availability check Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 076/107] octeontx2-af: fix lbk link credits on cn10k Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 077/107] RDMA/mlx5: Initiate dropless RQ for RAW Ethernet functions Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 078/107] RDMA/cma: Always set static rate to 0 for RoCE Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 079/107] IB/uverbs: Fix to consider event queue closing also upon non-blocking mode Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 080/107] IB/isert: Fix dead lock in ib_isert Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 081/107] IB/isert: Fix possible list corruption in CMA handler Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 082/107] IB/isert: Fix incorrect release of isert connection Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 083/107] net: ethtool: correct MAX attribute value for stats Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 084/107] ipvlan: fix bound dev checking for IPv6 l3s mode Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 085/107] sctp: fix an error code in sctp_sf_eat_auth() Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 086/107] igc: Clean the TX buffer and TX descriptor ring Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 087/107] igb: fix nvm.ops.read() error handling Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 088/107] drm/nouveau: dont detect DSM for non-NVIDIA device Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 089/107] drm/nouveau/dp: check for NULL nv_connector->native_mode Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 090/107] drm/nouveau: add nv_encoder pointer check for NULL Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 091/107] cifs: fix lease break oops in xfstest generic/098 Greg Kroah-Hartman
2023-06-19 10:31 ` Greg Kroah-Hartman [this message]
2023-06-19 10:31 ` [PATCH 5.15 093/107] net/sched: cls_api: Fix lockup on flushing explicitly created chain Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 094/107] net: lapbether: only support ethernet devices Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 095/107] dm: dont lock fs when the map is NULL during suspend or resume Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 096/107] net: tipc: resize nlattr array to correct size Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 097/107] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 098/107] afs: Fix vlserver probe RTT handling Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 099/107] cgroup: always put cset in cgroup_css_set_put_fork Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 100/107] rcu/kvfree: Avoid freeing new kfree_rcu() memory after old grace period Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 101/107] neighbour: Remove unused inline function neigh_key_eq16() Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 102/107] net: Remove unused inline function dst_hold_and_use() Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 103/107] net: Remove DECnet leftovers from flow.h Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 104/107] neighbour: delete neigh_lookup_nodev as not used Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 105/107] of: overlay: add entry to of_overlay_action_name[] Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 106/107] mmc: block: ensure error propagation for non-blk Greg Kroah-Hartman
2023-06-19 10:31 ` [PATCH 5.15 107/107] nilfs2: reject devices with insufficient block count Greg Kroah-Hartman
2023-06-19 13:46 ` [PATCH 5.15 000/107] 5.15.118-rc1 review Florian Fainelli
2023-06-20  9:17 ` Chris Paterson
2023-06-20  9:35 ` Harshit Mogalapalli
2023-06-20 10:21 ` Jon Hunter
2023-06-20 11:34 ` Sudip Mukherjee (Codethink)
2023-06-20 13:46 ` Naresh Kamboju
2023-06-20 17:07 ` Allen Pais
2023-06-20 21:04 ` Shuah Khan
2023-06-21 13:59   ` Greg Kroah-Hartman
2023-06-22 18:46     ` Shuah Khan
2023-06-20 21:31 ` Ron Economos
2023-06-21  0:39 ` Guenter Roeck

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=20230619102145.769027998@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=fmdefrancesco@gmail.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+4acc7d910e617b360859@syzkaller.appspotmail.com \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).