| Age | Commit message (Collapse) | Author |
|
Some platforms expose a UEFI DSM table with the expected revision
but with an empty QUERY bitmap, which means no DSM function is
advertised as valid.
Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Link: https://patch.msgid.link/20260922144819.fe9c61c887e1.I735e6a67f7fb4903ddeca84f0a2ca5cd062ba1df@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
If we allocated a recovery buffer, but didn't eventually send the
recovery command (for example because we failed to load the FW),
We won't free the buffer until the module is unloaded.
If in between another FW error occured, we will override the pointer
with a new allocated buffer without freeing the previous one.
Fix this by freeing a previous buffer before allocating a new one.
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20260922144819.36e637b8162a.Ida6e834d7f5d1e69d46c47e2e46db1e87a57ac71@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
If we are recovering from FW error but we don't have a reocvery buffer
(for example due to a driver bug), it means that the FW might not have all
the data it needs and we can therefore have bugs after the recovery.
Those bugs can be difficult to debug. Log a clear error in such case.
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20260922144819.afd6c953d680.Ibbf29ef47b99a9037a56b3342883376e9f7749dd@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Add support for scan iteration complete notification v3. This
version is a superset of the previous version and adds information
about the EBS corresponding with this scan iteration.
Assisted-by: GitHub-Copilot:claude-opus-5
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://patch.msgid.link/20260922144819.daf57b66d8a9.I1ff60b070464ea5cc1f402293c2342157d29ea79@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
In some cases the frame status is changed to AID_NOT_FOR_US if no data
is received. Pass the status explicitly so that the PHY data remains
intact as that simplifies debugging.
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20260922144819.86c1201ae2f6.I4b10b530325df711c7d229f1c487285a4dfcd294@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
A failed ctxt-info-v2 allocation can free prph_scratch/prph_info
without clearing the stored transport pointers.
Clear stale DMA address/pointer fields during unwind.
Also add an alloc-entry WARN_ON_ONCE/-EBUSY invariant to reject re-entry
when ctxt/prph/iml state is already populated.
Also, assign iml_len only the allocation.
Assisted-by: GitHubCopilot:gpt-5.3-codex
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.be2c3cf96a4e.I207172d76a22c0302575f3383a044700f97a9980@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
iwl_pcie_prep_tso() obtains a TSO header page via
iwl_pcie_get_page_hdr(), which stores the page in skb->cb
and increments its internal reference count.
If skb_to_sgvec() or dma_map_sgtable() then fails, the
function returns NULL without calling iwl_pcie_free_tso_pages()
or otherwise dropping the page reference and/or DMA mapping.
Fix this page leak.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.9f5a0b76e75e.Ic7d2303cb85a6de5158a713f57d4366c7b0d93b0@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Add support for version 9 of the LINK context config command, which
carries the max BSSID indicator N, where 2**N is the maximal number of
BSSIDs the physical AP can support.
The firmware uses this to mask N bits of the transmitter address for
NPCA OBSS and inter/intra BSS NAV decisions. N=0 disables the feature.
Assisted-by: GithubCopilot:claude-opus-4.8
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.fafac4d1052d.I91be3bcfcd25d23b5c10c043d6cd639de4efa214@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
The htc_trig_based_pkt_ext, rand_alloc_ecwmin, rand_alloc_ecwmax and
frame_time_rts_th fields of the LINK context config command are not
used by the firmware. Stop filling them.
Assisted-by: GithubCopilot:claude-opus-4.8
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.887695af3d15.Ie0f0804a28ec4e1e8e41d0eb11615ed2a0f2823e@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Treat firmware-provided NVM response length as untrusted before copying
data into the host buffer.
Reject responses that are shorter than the fixed response header, where
reported bytes exceed the requested chunk length, or where payload size
does not contain the reported number of bytes.
This prevents heap overwrite and RX payload over-read in malformed or
malicious NVM_ACCESS responses.
Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.a9d384de40a0.Id6028e4753a2af5638bed0279bbf55842845df3b@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
The monitor_data debugfs file exposed the DRAM firmware monitor buffer
to userspace. Remove it along with all the code and data that only
existed to support it: the read/open/release handlers and the
iwl_write_to_user_buf() helper, the cont_rec state tracking structure
and iwl_fw_mon_dbgfs_state enum, the fw_mon_data field and its
initialization, and the now-unused debugfs cleanup path
(iwl_trans_pcie_debugfs_cleanup() and iwl_trans_debugfs_cleanup()).
This relied on old firmware monitor format.
Assisted-By: GitHubCopilot:Claude Opus 4.8
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.9e5d30a9caa4.Idf62277c82970daf49d3d4d7b7a021595672eeed@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
There is a race between the PCI link power save flow and the
notification flow from the firmware. The firmware prepares the
notification in DRAM and then sends an MSI-X message to interrupt the
CPU and let it know it can handle the notification. In case the PCI
link goes L1.2 between the access to the DRAM to copy the notification
and the MSI-X interrupt, the host won't be interrupted.
Add a work-around to cope with this situation. If the command response
was not received after 200ms, read the config space of the device just
to wake up the link. This will allow the MSI-X interrupt to go through
and the CPU will get the interrupt.
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221501
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260922144819.ef433f3da32b.I017c1c7a1dd3ac6f111d4640966968b82f37e291@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Add STATISTICS_FW_NTFY_OPERATIONAL_API_S_VER_5, which uses a new
per-PHY struct (VER_3) that appends the NPCA channel load fields.
Assisted-by: GitHubCopilot:claude-opus-4.8
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20260922144819.971d1a747698.I0792723d62dca7cf68056f13c8f733084ce6445f@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
FW expects all keys to be removed before removing a station.
On NAN teardown, iwl_mld_stop_nan() removed the NAN
internal stations while their IGTK/BIGTK were still in FW.
mac80211 frees NAN keys only after drv_stop_nan() returns, so
they are available while NAN is still up.
Remove the NAN group keys before deleting the NAN internal stations.
Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233731.6d541e506ee4.Idaed08b15314b26abb4dc9f4a8a41e61a021597e@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Some Google devices with ASUS board vendor need to be included in the
TAS approved DMI list so TAS policy is applied for this platform
combination.
Add a new GOOGLE-ASUS match entry using DMI_SYS_VENDOR=Google and
DMI_BOARD_VENDOR=ASUS in the approved list. This change only extends
platform coverage and does not alter existing matching behavior.
Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Assisted-by: GitHubCopilot:GPT-5.3-Codex
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233731.43ea7ba69e05.Ib2ec495e6dea3db1db783d43171505bd03d24cf6@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Make this dependency explicit. We use the ieee80211_p2p_noa_desc
structure in the FW API file.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233731.13c9033a18cf.I2d3f3b8e2d4c7af0961726219974db2485e8312e@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
hcmd.h relies on mld.h. Make this dependency explicit.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233731.252cd5ae36b1.I5ea033fff1dcabd46e7d66f15c140dce2c5c9a1f@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
A DRAM buffer allocation shouldn't have an ID of 0. If a broken TLV
contained such an id, this buffer will be allocated and a command will
be sent to the FW. regardless of the FW asserting on that or not, this
buffer will never be freed,
since in the free path we do check for INVALID...
Link: https://patch.msgid.link/20260921233731.ebd907861742.Ib74687a84e65d2e5295d338600283978a7018375@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
iwl_dbg_tlv_alloc_region() did not validate reg->dram_alloc_id for
IWL_FW_INI_REGION_DRAM_BUFFER regions, and the DRAM monitor dump
consumers in fw/dbg.c used it directly to index the fw_mon_ini array.
Check that dram_alloc_id is in range at TLV parse time, and add bounds
checks in iwl_dump_ini_mon_dram_iter(), iwl_dump_ini_mon_dram_ranges()
and iwl_dump_ini_mon_dram_get_size() before accessing the array.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233730.4c896fab0bb7.I3296a5523ce58df085ea0867694ea157c00945bd@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
This is not really secure and we won't really need on old devices
(driven by iwlmvm) anyway.
Just remove the code.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233730.60f5274c7116.Ieec87672d84763b599e2d322525f68acff63e701@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
iwl_trans_pcie_txq_disable() computed SCD_TX_STTS_QUEUE_OFFSET(txq_id)
and dereferenced trans_pcie->txqs.txq[txq_id] before checking that
txq_id is within range or that the queue was allocated.
Bail out with a WARN_ON when txq_id is out of range or the queue is not
allocated, and only compute the status address after the checks pass.
We don't really want to disable the command queue either, so check that
as well.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233730.c96ee7e007bc.Ie593dfd5451be69a5e6deca248a4b443e168ac88@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
The INI/Yoyo debug TLVs are parsed from an untrusted firmware-debug
file. The dispatcher only guarantees that the
TLV length covers the 8-byte common header, yet several per-type
handlers dereferenced fields located beyond that header before
checking the TLV length.
Add the missing minimum-length check in iwl_dbg_tlv_config_set() so
the short TLV is rejected before it is stored, and move the field
reads in the other handlers to after their existing length checks so
no field is dereferenced before the buffer is known to be large
enough.
Signed-off-by: Shahar Tzarfati <shahar.tzarfati@intel.com>
Assisted-by: GitHub-Copilot:claude-opus-4-8
Link: https://patch.msgid.link/20260921233730.6127e849e40a.If963f766dbe29cbb8c226e163ab678be97240730@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
The INI debug dump get_size handlers compute the region size as
hdr_size + ranges * (size + sizeof(range)) using u32 arithmetic.
Both the per-range size and the number of ranges originate from
debug TLVs with no upper bound, so the multiplication and additions
can overflow u32. A small value passes the
size < sizeof(*header) check in iwl_dump_ini_mem_prep().
Add the size computation in each handler using
check_add_overflow()/check_mul_overflow() and return 0 when the
result would overflow. For the block handler the variable per-pair
sizes are summed with check_add_overflow() before computing size,
since that accumulation can overflow on its own.
Signed-off-by: Shahar Tzarfati <shahar.tzarfati@intel.com>
Assisted-by: GitHub-Copilot:claude-opus-4-8
Link: https://patch.msgid.link/20260921233730.0644f76cd8af.Id0d26b11fcdb33a5eff7824343caa6dc23385fd5@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
When we receive the TLC notif, we try to fetch the band from the vif
link. However, in NAN we don't have the bss_conf (link_conf[0] is
technically pointing to vif::bss_conf, but it doesn't point to a
channel).
For now we don't have a way to fetch the channel used by this TLC
instance (a NAN station can have multiple), but in the future we will
have a TLC object in the driver and then we will have a phy id in it.
For now, just take either the minimum between both lmacs or the only
existing one.
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20260921233730.18fefde9f26d.I8bc0c16de230f3bd45b80101db0936f1e4aea516@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
This delay is given in the same format as in the CIP capabilities.
Update the comment to make it clear that the resolution is 4 us.
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20260921233730.0947a2665f17.Ic994dae3eddf50955eac4cf79cb6388887c75b67@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
When a NAN link is activated, the TLC config command was sent for all
the NAN stations. The TLC config was sent on all phys used by NAN.
However, when a new NAN channel is added when there is already a NAN
station (e.g. during schedule update), the station is not yet
attached to the link of this phy (until the new schedule is
applied by firmware). Sending a TLC command for the station on the
new phy at this stage results in an assert because in firmware the
station is not yet attached with the phy of this channel.
Fix it by sending the TLC command only after configuring the station
for the new phy.
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Link: https://patch.msgid.link/20260921233730.24cefdd72e7d.Ib32c29716c805531f881c61d13931f5b3d7084a9@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
In case we keep getting data from the AP, wait for 6 missed beacons
since last Rx before disconnecting.
This will give the firmware a chance to send NDPs to the AP and avoid
disconnecting if the AP is still there.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260921233730.025f2655b3b1.Ieceece6d8f660399e844ea4dadac414243e35d07@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
Introduce support for (re)association request/response encryption if
supported by the firmware.
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://patch.msgid.link/20260921233730.25ccedf95d32.Ie2834534bd644593b61a063d4ec5f7e323be4370@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
|
|
__MODULE_STRING() has been an alias for __stringify() since "[PATCH]
MODULE_PARM support for older modules" [1] in 2002-12. That change also
moved it to the graveyard section at the end of linux/module.h
Replace the remaining uses of __MODULE_STRING() with __stringify() in
preparation for its removal.
Link: https://git.kernel.org/tglx/history/c/136839a1b4 [1]
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Acked-by: Ian Abbott <abbotti@mev.co.uk>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Mika Westerberg <westeri@kernel.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
|
|
try_add_tainted_module() allocates the tracking record without zeroing
it and initializes the fields in this order:
mod_taint = kmalloc_obj(*mod_taint);
strscpy(mod_taint->name, mod->name, MODULE_NAME_LEN);
mod_taint->taints = mod->taints;
list_add_rcu(&mod_taint->list, &unloaded_tainted_modules);
mod_taint->count = 1;
The record is published by list_add_rcu() before the count field is
written. The readers, unloaded_tainted_modules_seq_show() (debugfs,
under rcu_read_lock()) and print_unloaded_tainted_modules() (panic
path, under guard(rcu)), traverse the list under RCU and read
mod_taint->count. module_mutex, which the writer holds, does not
exclude RCU readers.
A reader that observes the new node between the list_add_rcu() and
the count store reads an uninitialized u64 left over from previous
slab use. This is a data race and leaks kernel heap residue through
the debugfs file and the panic message.
The race window is two adjacent instructions; it is reachable when a
tainted module is unloaded (rmmod) concurrently with a read of
/sys/kernel/debug/module/unloaded_tainted, or with the module list
printout of an oops on another CPU.
Fix this by initializing count before the record is published.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: 99bd9956551b ("module: Introduce module unload taint tracking")
Signed-off-by: Binbin Deng <18983559317@163.com>
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
|
|
The `set_param` function casts `kernel_param.arg` to `*const SetOnce<T>`
But the Rust module macro in rust/macros/module.rs initializes `arg` with
`#param_name.as_void_ptr()`, and `#param_name` is a `ModuleParamAccess<T>`,
not a `SetOnce<T>`.
ModuleParamAccess<T> has default Rust layout but `set_param` accesses its
first field SetOnce<T> assuming it to be at offset 0. This is not
guaranteed by Rust and could cause type confusion leading to data
corruption.
Fix this by casting `kernel_param.arg` to `ModuleParamAccess<T>` and
then accessing the `value: SetOnce<T>` field.
Fixes: 0b08fc292842 ("rust: introduce module_param module")
Cc: stable@vger.kernel.org
Reported-by: Dylan Zueck <dzueck@uci.edu>
Assisted-by: LLM
Suggested-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: Priya Bala Govindasamy <pgovind2@uci.edu>
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
|
|
xfs_calc_group_awu_max() clamps the atomic write unit maximum to the
greatest power-of-two factor of the group size when the device advertises
atomic writes, so that allocations can be made naturally aligned for
REQ_ATOMIC. But that value is the software limit: it is only used when
reflink is enabled, and out of place writes through the COW fork have no
alignment requirement.
Compute the software limit from the group size alone, and apply the
alignment constraint in xfs_get_atomic_write_max_opt() instead, which is
what reports the size that can be offloaded to the hardware.
Results on a 14TB device with 16k hardware atomic support with 16k
blocksize:
Without patches:
[nix-shell:~]# trace-cmd report
cpus=16
mount-617 [009] 1184.719159: xfs_calc_atomic_write_unit_max: dev 259:2 ag
max_write 131072 max_ioend 4096 max_gsize 2 awu_max 2
[nix-shell:~]# ./statx /media/test/hello.txt
/media/test/hello.txt:
stx_atomic_write_unit_min: 16384
stx_atomic_write_unit_max: 32768
stx_atomic_write_unit_max_opt: 16384
stx_atomic_write_segments_max: 1
With patches:
[nix-shell:~]# trace-cmd report
cpus=16
mount-598 [005] 319.692000: xfs_calc_atomic_write_unit_max: dev 259:2 ag
max_write 131072 max_ioend 4096 max_gsize 33554432 awu_max 4096
[nix-shell:~]# ./statx /media/test/hello.txt
/media/test/hello.txt:
stx_atomic_write_unit_min: 16384
stx_atomic_write_unit_max: 67108864
stx_atomic_write_unit_max_opt: 16384
stx_atomic_write_segments_max: 1
Fixes: 0c438dcc3150 ("xfs: add xfs_calc_atomic_write_unit_max()")
Assisted-by: LLM
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: John Garry <john.garry@linux.dev>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
Three xfs_btree_delete() calls in xfs_ialloc.c fail to check the status
returns indicating whether a record was actually deleted. If the cursor
was pointing to something that couldn't be deleted or didn't exist,
something has gone wrong, so mark the fs as sick and return
EFSCORRUPTED.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
The xfs_inobt_get_rec() call in xfs_ialloc_count_ondisk fails to check
the &has_record return - if the record is not found, the next
conditional will read an uninitialized or stale irec. Fix that.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
The NULL checks on the merged ioends added in commit ae285611891f ("xfs:
handle NULL open_zone for merged ioends in xfs_ioend_put_open_zones") got
lost when the code was moved to a new file. Reinstate the check, and
also update the comments to be a little more coherent.
Fixes: 6b855256eb9e ("xfs: split ioend handling into a separate source file")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
A reviewer suggested that I formalize the conversion between the inode
forkoff field and actual byte count, so let's add a few conversion
macros and a helper function to compute the default forkoff; and then
adjust the codebase to use them.
No functional changes intended.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
Drop the sr parameter from the scrub rtgroup functions because the value
is always the same.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
Drop the sa parameter because it's always the same value.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
Similar to the last patch, drop this unnecessary sr parameter instead of
dealing with pointer aliasing.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM went down a crazy path complaining about the horrible things that
happen in these functions if sa != &sc->sa. However, I observe that the
sa argument is never not &sc->sa, so let's just drop the parameter.
There's no bug here, but let's get rid of some stupid.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM complains that we don't do enough bounds checking of the directory
entries in directory blocks when we're looking for errors or trying to
salvage entries. Let's improve that with more detailed checks.
Cc: stable@vger.kernel.org # v4.16
Fixes: ce92d29ddf9908 ("xfs: directory scrubber must walk through data block to offset")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
Hoist the inner loop code of the directory data block walking code in
the directory scrub and repair code to separate functions in preparation
for strengthening the validation in a subsequent patch.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
xfs/085 exposes an interesting bug when metadir is enabled, quotas are
enabled via mount option, and the primary superblock crc fails
validation:
Phase 1 - find and verify superblock...
bad primary superblock - bad CRC in superblock !!!
attempting to find secondary superblock...
.found candidate secondary superblock...
verified secondary superblock...
quota accounting and enforcement flags lost
<snip>
Phase 3 - for each AG...
- scan and clear agi unlinked lists...
- process known inodes and perform inode discovery...
- agno = 0
- agno = 1
- agno = 2
unexpected regular file inode 16908418 with metadata flag will zap
cleared inode 16908418
unexpected regular file inode 16908419 with metadata flag will zap
cleared inode 16908419
unexpected regular file inode 16908420 with metadata flag will zap
cleared inode 16908420
- agno = 3
- process newly discovered inodes...
Quota files have been created, but xfs_repair thinks that quotas aren't
enabled and trashes the quota files. Looking at the filesystem reveals
that the quota accounting flags were indeed persisted to the primary
superblock but not the secondary:
# xfs_db -c 'sb 0' -c 'print qflags' -c 'sb 1' -c 'print qflags' /dev/sdf
Metadata corruption detected at 0x561c68436080, inode 0x81 dinode
xfs_db: Failed to load metadir root directory, error 117
Metadata corruption detected at 0x561c683f7c80, xfs_agf block 0x1/0x200
xfs_db: cannot init perag data (117). Continuing anyway.
Metadata CRC error detected at 0x561c6844d1b5, xfs_sb block 0x0/0x200
qflags = 0x7cf
qflags = 0
On a metadir filesystem, quota state is supposed to persist across
mount cycles if the sysadmin doesn't provide any quota mount options.
Therefore, any time we update the quota flags on a metadir filesystem,
we should write the same change to the secondary supers so that
xfs_repair will find the quota data if it ever has to restore from a
secondary.
Cc: stable@vger.kernel.org # v6.13
Fixes: d5d9dd5b3026a8 ("xfs: persist quota flags with metadir")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM observed that we can erroneously try to repair the rtsummary file
if we've not yet computed its contents. That results in a corrupt
summary file, so let's add a flag to track whether or not the incore
data is complete.
Cc: stable@vger.kernel.org # v6.10
Fixes: abf039e2e4afde ("xfs: online repair of realtime summaries")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM complains that percpu_counter_sum can return a negative number but
we instead misinterpret that into a huge unsigned value and do bad
things to fdblocks. It shouldn't do that, so let's add a retry loop and
an attempt to freeze the filesystem to (hopefully) zero out the incore
delalloc counter. It probably won't work, but at least failing the
repair beats doing the wrong thing.
Cc: stable@vger.kernel.org # v5.2
Fixes: 75efa57d0bf5fc ("xfs: add online scrub for superblock counters")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM points out that it's pointless to rescan the AGs if we've already
frozen the filesystem because there won't be any more perturbations.
Fix this to mark the scan incomplete and exit.
Cc: stable@vger.kernel.org # v5.2
Fixes: 75efa57d0bf5fc ("xfs: add online scrub for superblock counters")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM complains that it's weird to set a metadata directory's parent
inumber to the regular directory tree root. Fix this even if nobody's
ever going to notice this because metadata path lookups don't access
dotdot.
Cc: stable@vger.kernel.org # v6.13
Fixes: 4f3d4dd1b04b2b ("xfs: define the on-disk format for the metadir feature")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
kmem_buckets_create() had the same sentence about calling context as
kmem_cache_create(), but lacked the "Context:" prefix, so kernel-doc
rendered in the body instead of as a "context" section.
Give it the missing prefix. Additionally fix the "a interrupt" typo
__kmem_cache_create_args() had.
Fixes: b32801d1255be ("mm/slab: Introduce kmem_buckets_create() and family")
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
Acked-by: Pedro Falcato <pfalcato@suse.de>
Reviewed-by: Hao Li <hao.li@linux.dev>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20261014052344.384723-1-kees@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
|
|
LOLLM points out that the directory repair code should never scan files
in the regular directory tree when fixing a metadata directory and
vice-versa. Amend the scan predicate to check this condition.
Cc: stable@vger.kernel.org # v6.13
Fixes: 4f3d4dd1b04b2b ("xfs: define the on-disk format for the metadir feature")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|
|
LOLLM complains that the error processing functions in scrub will
sometimes zero out *error before recording a tracepoint. This makes
diagnosing problems harder, so let's fix that.
Cc: stable@vger.kernel.org # v4.15
Fixes: 4700d22980d459 ("xfs: create helpers to record and deal with scrub problems")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
|