Linux 6.18.47
Greg Kroah-Hartman
maintainerI'm announcing the release of the 6.18.47 kernel.
All users of the 6.18 kernel series must upgrade.
The updated 6.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-6.18.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 drivers/block/null_blk/zoned.c | 10 + drivers/bluetooth/hci_aml.c | 18 +++ drivers/dma/fsl-edma-main.c | 2 drivers/gpu/drm/xe/display/xe_fb_pin.c | 32 +----- drivers/hid/hid-core.c | 11 +- drivers/hid/hid-hyperv.c | 27 ++++- drivers/hid/hid-input.c | 3 drivers/hid/hid-magicmouse.c | 64 +++++++++++- drivers/hid/hid-nintendo.c | 22 ++-- drivers/hid/hid-sensor-custom.c | 17 +-- drivers/hid/hid-uclogic-core.c | 12 ++ drivers/hid/usbhid/hid-pidff.c | 13 +- drivers/input/keyboard/atkbd.c | 23 +++- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 15 ++ drivers/iommu/iommufd/ioas.c | 4 drivers/mailbox/mailbox-mchp-ipc-sbi.c | 2 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 17 ++- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 7 + drivers/net/usb/rndis_host.c | 6 - drivers/nfc/fdp/i2c.c | 27 +++++ drivers/nfc/microread/microread.c | 31 +++++ drivers/nfc/pn533/pn533.c | 1 drivers/nfc/st21nfca/dep.c | 3 drivers/nvme/target/admin-cmd.c | 2 drivers/nvme/target/fabrics-cmd-auth.c | 2 drivers/nvme/target/fc.c | 2 drivers/nvme/target/pci-epf.c | 10 + drivers/nvme/target/tcp.c | 18 +++ drivers/pci/controller/pci-host-generic.c | 11 -- drivers/pci/ecam.c | 13 ++ drivers/ptp/ptp_vmclock.c | 6 + drivers/tty/serial/sc16is7xx.c | 40 +++---- fs/exec.c | 8 + fs/ext4/crypto.c | 40 +++---- fs/ext4/fast_commit.c | 16 ++- fs/ext4/ialloc.c | 4 fs/ext4/inode.c | 11 +- fs/ext4/super.c | 2 fs/ext4/xattr.c | 7 - fs/nilfs2/ioctl.c | 20 +++ fs/ocfs2/xattr.c | 18 ++- fs/xfs/libxfs/xfs_attr_leaf.c | 14 ++ fs/xfs/scrub/agheader.c | 96 +++++++++++++----- fs/xfs/scrub/agheader_repair.c | 17 ++- fs/xfs/scrub/bmap.c | 8 - fs/xfs/scrub/common.c | 10 - fs/xfs/scrub/common.h | 2 fs/xfs/scrub/dir.c | 2 fs/xfs/scrub/dirtree.c | 4 fs/xfs/scrub/metapath.c | 6 - fs/xfs/scrub/nlinks.c | 12 +- fs/xfs/scrub/parent.c | 6 - fs/xfs/scrub/rtbitmap.c | 12 +- fs/xfs/scrub/rtsummary.c | 12 +- include/linux/futex.h | 2 include/linux/pci-ecam.h | 3 include/linux/sched.h | 8 + include/linux/wait.h | 1 include/linux/wait_bit.h | 1 io_uring/futex.c | 11 ++ io_uring/futex.h | 1 io_uring/io-wq.c | 9 + io_uring/opdef.c | 2 io_uring/rsrc.c | 2 io_uring/uring_cmd.c | 8 - kernel/futex/core.c | 116 ++++++++++++++-------- kernel/futex/futex.h | 9 + kernel/futex/pi.c | 121 +++++++++++++++++------ kernel/kcov.c | 90 ++++++++--------- kernel/sched/wait.c | 15 ++ kernel/sched/wait_bit.c | 14 ++ lib/Kconfig.debug | 5 net/bluetooth/hci_event.c | 8 + net/bluetooth/hci_sync.c | 46 +++++++- net/bluetooth/iso.c | 32 ++++-- net/bluetooth/mgmt.c | 8 + net/bluetooth/rfcomm/core.c | 24 +++- net/ceph/osd_client.c | 5 net/core/gro.c | 7 - net/ipv4/ip_output.c | 4 net/ipv6/ip6_output.c | 2 net/mptcp/options.c | 2 net/mptcp/pm.c | 74 +++++++------- net/mptcp/pm_kernel.c | 22 ++-- net/mptcp/pm_userspace.c | 10 + net/mptcp/protocol.h | 25 ++-- net/mptcp/subflow.c | 4 net/nfc/digital_technology.c | 2 net/nfc/llcp_commands.c | 18 +++ net/nfc/llcp_core.c | 15 ++ net/nfc/nci/ntf.c | 36 +++++- net/nfc/nci/rsp.c | 1 net/xfrm/xfrm_state.c | 4 sound/drivers/dummy.c | 6 + sound/soc/codecs/lpass-tx-macro.c | 4 sound/usb/fcp.c | 38 +++---- sound/usb/mixer.c | 6 + sound/usb/mixer.h | 2 sound/usb/mixer_scarlett2.c | 98 +++++++++++------- 102 files changed, 1235 insertions(+), 489 deletions(-)
Abdifatah Suruur (1):
ptp: vmclock: prevent read-only mappings from becoming writable
Ali Ahmet Memis (5):
Bluetooth: RFCOMM: take rfcomm_mutex for the deferred setup accept io_uring/rsrc: fix folio size overflow in io_vec_fill_bvec()
Bluetooth: ISO: do not force BT_LISTEN after a failed BIG sync
Bluetooth: ISO: zero the sockaddr before returning it in getname
Bluetooth: MGMT: reject HCI_CMD_SYNC params_len above 255
Anand Khoje (1):
net/ionic: avoid OOB TX partner lookup for hwstamp RXQ
Andrei Fed (1):
HID: magicmouse: fix battery reporting for Bluetooth Magic Trackpad USB-C
Baul Lee (2):
HID: core: fix OOB read of field->usage in hid_set_field()
HID: pidff: fix OOB write when hid->inputs is emptyBryam Vargas (3):
nfc: fdp: bound the device-reported read length and fix an skb leak
nfc: nci: add data_len bound checks to activation parameter extractors
nvmet-auth: zero the AUTH_RECEIVE response buffer
Chengfeng Ye (2):
Bluetooth: hci_event: fix LE list UAF on reset
Bluetooth: hci_sync: Fix accept list UAF during suspend
Christoph Hellwig (1):
xfs: add a xchk_ip_set_corrupt helper
Christopher Kodama (1):
HID: magicmouse: re-enable multitouch after reset-resume
Cryolitia PukNgae (1):
Input: atkbd - skip deactivate for HONOR FMB-P's internal keyboard
Darrick J. Wong (3):
xfs: rtsummary scrub should treat rtbitmap corruption errors as an xref error
xfs: hoist per-bucket unlinked list check to helper
xfs: don't livelock in scrub on a circular unlinked list
Dawid Wróbel (1):
ASoC: codecs: lpass-tx-macro: Fix enum kcontrol accesses
Donglin Lyu (1):
Input: atkbd - skip deactivate for HONOR ZQC-P
Doruk Tan Ozturk (4):
nfc: digital: clamp SENSF_RES length to the destination buffer
nfc: llcp: bound the connect_sn TLV walk to the skb
nfc: llcp: reject PDUs shorter than the LLCP header
nfc: st21nfca: validate ATR_REQ length against the received frame
Eric Biggers (1):
ext4: don't enable DAX on new encrypted files
Eric Dumazet (1):
net: gro: properly validate BIG TCP aggregation criteria
Felix Hoffmann (1):
futex: Avoid private hash use-after-free on final put
Geoffrey D. Bennett (2):
ALSA: FCP: Use a private URB for the notification endpoint
ALSA: scarlett2: Use a private URB for the notification endpoint
Greg Kroah-Hartman (2):
nvmet-tcp: Do not WARN on remotely-controlled oversized SGL allocations Linux 6.18.47
Griffin Kroah-Hartman (3):
rndis_host: add overflow check in rndis_rx_fixup()
mailbox: mchp-ipc-sbi: Add null check for devm_kasprintf()
dmaengine: fsl-edma: Add error handling for devm_kasprintf
Guanghui Yang (2):
ext4: clear error before retrying inode xattr space fallback
ext4: propagate errors from fast commit range replay
Guixin Liu (1):
nvmet: fix NULL pointer dereference in nvmet_execute_identify_nslist()
Haoxiang Li (1):
HID: sensor: custom: Fix use-after-free in enable_sensor
Hongling Zeng (1):
xfs: validate attr entry pointer before field access
Hugo Villeneuve (2):
serial: sc16is7xx: rename EFR mutex with generic name
serial: sc16is7xx: use guards for simple mutex locks
Hyunwoo Kim (1):
futex: Fix race on the initial mm->futex.phash.ref allocation
Ian Bridges (1):
ocfs2: fix missing metadata reservation for large xattrs
Ibrahim Hashimov (3):
nvmet-tcp: bound SGL data length before allocating command buffers
HID: nintendo: fix out-of-bounds read in joycon_ctlr_read_handler()
HID: uclogic: fix use-after-free of inrange_timer on remove
Jann Horn (1):
HID: core: fix number/pointer type confusion on long items
Jens Axboe (2):
io_uring/futex: don't mark futex wake requests as inflight io_uring/uring_cmd: don't skip completion for a synchronous multishot cmd
Jia Zhu (1):
ext4: avoid tail write_begin walk for uptodate folios
Jiang HongHui (1):
nvmet-fc: fix invalid free in LS IOD error path
Jiangshan Yi (2):
HID: nintendo: register input device after capabilities are set
HID: nintendo: stop device IO before hid_hw_stop on probe failure
Jiazi Liu (1):
ext4: fix incorrect function call when initializing s_resgid
Jose Villaseñor Montfort (1):
HID: magicmouse: do not keep a stale msc->input if no input is claimed
Kyle Zeng (1):
futex/pi: Reject cross-mm private futex owners
Laxman Acharya Padhya (2):
Bluetooth: hci_event: validate LE Set CIG Parameters response
Bluetooth: hci_aml: validate firmware segment lengths
Lee Jones (1):
HID: magicmouse: Prevent out-of-bounds (OOB) read during DOUBLE_REPORT_ID
Linmao Li (1):
nfc: nci: free destination parameters when closing a connection
Luca Fresi (1):
serial: sc16is7xx: enable THRI before filling TX FIFO
Luxiao Xu (1):
ipv6: fix use-after-free in ip6_finish_output2()
Maarten Lankhorst (1):
drm/xe: Fix DPT allocation paths.
Matthias Goergens (1):
ext4: stop retrying saturated xattr cache entries
Matthieu Baerts (NGI0) (3):
mptcp: pm: use for_each_subflow helper
mptcp: pm: rename add_entry structure to add_addr
mptcp: pm: uniform announced addresses helpers
Michael Bommarito (1):
HID: hyperv: validate initial device info bounds
Muhammad Bilal (1):
nfc: llcp: fix OOB read and u8 offset wrap in TLV parsers
Pavitra Jha (1):
libceph: fix OOB read in decode_watchers() via missing bounds check
Peiyang He (1):
iommu/iommufd: Fix NULL pointer deref in iommufd_ioas_change_process when racing with iopt_map_file_pages
Pengpeng Hou (1):
nfc: microread: validate target discovery payload lengths
Peter Zijlstra (1):
futex: Fix might_sleep() warning in futex_pivot_pending()
Rik van Riel (1):
null_blk: fix UBSAN shift-out-of-bounds when zone_size is 0 or overflows
Ryusuke Konishi (1):
nilfs2: reject invalid block index in GC ioctl
Samuel Page (2):
nfc: nci: fix out-of-bounds write in nci_target_auto_activated()
nfc: nci: fix uninit-value in the RF discover/activated NTF handlers
Shameer Kolothum (1):
iommu/tegra241-cmdqv: Fix CMD_SYNC use-after-free on teardown
Shardul Bankar (1):
mptcp: pm: fix memory leak from alloc-during-teardown race
Shin'ichiro Kawasaki (1):
nvmet: pci-epf: fix use-after-free in nvmet_pci_epf_exec_iod_work()
Steffen Persvold (1):
PCI: host-generic: Fix NULL pointer dereference on 32-bit CAM systems
Takashi Iwai (1):
ALSA: dummy: Check card index validity at probe
Tetsuo Handa (1):
kcov: fix data corruption and race conditions on PREEMPT_RT
Thomas Gleixner (2):
futex: Sanitize and document task_struct::futex::state transitions futex/pi: Plug private futex exec() race
Vishnu Razdan (1):
io_uring/io-wq: fix worker accounting when canceling creation callbacks
Woraphat Khiaodaeng (1):
io_uring/cmd: fix iovec leak when the async cmd is not recycled
Xiang Mei (Microsoft) (1):
xfrm: fix sk_dst_cache double-free in xfrm_user_policy()
Xu Rao (1):
nfc: pn533: purge fragmented skbs during cleanup
Yifei Gao (1):
nvmet: pci-epf: put CQ ref on create_cq mapping failure
Yong Wang (1):
ipv4: reject undersized MTUs in ip_do_fragment()
Greg Kroah-Hartman
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 6 PATCHLEVEL = 18 -SUBLEVEL = 46 +SUBLEVEL = 47 EXTRAVERSION = NAME = Baby Opossum Posse
drivers/block/null_blk/zoned.c +8 -2
@@ -18,6 +18,8 @@ static inline sector_t mb_to_sects(unsigned long mb)static inline unsigned int null_zone_no (struct nullb_device *dev,sector_t sect) { +if (WARN_ON_ONCE (!dev->zone_size_sects)) +return 0 ;return sect >>ilog2 (dev->zone_size_sects); }
@@ -56,8 +58,8 @@ int null_init_zoned_dev(struct nullb_device *dev,sector_t sector =0 ;unsigned int i; -if (!is_power_of_2 (dev->zone_size)) { -pr_err ("zone_size must be power-of-two\n" ); +if (!dev->zone_size || !is_power_of_2 (dev->zone_size)) { +pr_err ("zone_size must be non-zero power-of-two\n" );return -EINVAL ; }if (dev->zone_size > dev->size) {
@@ -88,6 +90,10 @@ int null_init_zoned_dev(struct nullb_device *dev, zone_capacity_sects =mb_to_sects (dev->zone_capacity); dev_capacity_sects =mb_to_sects (dev->size); dev->zone_size_sects =mb_to_sects (dev->zone_size); +if (!dev->zone_size_sects) { +pr_err ("zone_size too large or too small, leads to zero sectors\n" ); +return -EINVAL ; + } dev->nr_zones =round_up (dev_capacity_sects, dev->zone_size_sects) >>ilog2 (dev->zone_size_sects);
drivers/bluetooth/hci_aml.c +16 -2
@@ -247,7 +247,7 @@ static int aml_download_firmware(struct hci_dev *hdev, const char *fw_name)struct hci_uart *hu =hci_get_drvdata (hdev);struct aml_serdev *amldev =serdev_device_get_drvdata (hu->serdev);const struct firmware *firmware =NULL ; -struct aml_fw_len *fw_len =NULL ; +const struct aml_fw_len *fw_len =NULL ;u8 *iccm_start =NULL , *dccm_start =NULL ;u32 iccm_len, dccm_len;u32 value =0 ;
@@ -281,7 +281,21 @@ static int aml_download_firmware(struct hci_dev *hdev, const char *fw_name) goto exit; } - fw_len = (struct aml_fw_len *)firmware->data; +if (firmware->size <sizeof (*fw_len)) { +bt_dev_err (hdev,"Firmware is too small for its header" ); + ret = -EINVAL ; + goto exit; + } + + fw_len = (const struct aml_fw_len *)firmware->data; +if (fw_len->iccm_len < amldev->aml_dev_data->iccm_offset || + fw_len->iccm_len > firmware->size -sizeof (*fw_len) || + fw_len->dccm_len > firmware->size -sizeof (*fw_len) - + fw_len->iccm_len) { +bt_dev_err (hdev,"Invalid firmware segment lengths" ); + ret = -EINVAL ; + goto exit; + }/* Download ICCM */ iccm_start = (u8 *)(firmware->data) +sizeof (struct aml_fw_len )
drivers/dma/fsl-edma-main.c +2 -0
@@ -414,6 +414,8 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi errirq_name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%s-err" ,dev_name (&pdev->dev)); +if (!errirq_name) +return -ENOMEM ; ret =devm_request_irq (&pdev->dev, fsl_edma->errirq, fsl_edma3_err_handler_shared,0 , errirq_name, fsl_edma);
drivers/gpu/drm/xe/display/xe_fb_pin.c +8 -24
@@ -101,30 +101,14 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb, dpt_size =ALIGN (intel_rotation_info_size (&view->rotated) *8 ,XE_PAGE_SIZE ); -if (IS_DGFX (xe)) - dpt =xe_bo_create_pin_map_at_novm (xe, tile0, - dpt_size, ~0ull , - ttm_bo_type_kernel, -XE_BO_FLAG_VRAM0 | -XE_BO_FLAG_GGTT | -XE_BO_FLAG_PAGETABLE , - alignment, false); -else - dpt =xe_bo_create_pin_map_at_novm (xe, tile0, - dpt_size, ~0ull , - ttm_bo_type_kernel, -XE_BO_FLAG_STOLEN | -XE_BO_FLAG_GGTT | -XE_BO_FLAG_PAGETABLE , - alignment, false); -if (IS_ERR (dpt)) - dpt =xe_bo_create_pin_map_at_novm (xe, tile0, - dpt_size, ~0ull , - ttm_bo_type_kernel, -XE_BO_FLAG_SYSTEM | -XE_BO_FLAG_GGTT | -XE_BO_FLAG_PAGETABLE , - alignment, false); + dpt =xe_bo_create_pin_map_at_novm (xe, tile0, + dpt_size, ~0ull , + ttm_bo_type_kernel, +XE_BO_FLAG_VRAM_IF_DGFX (tile0) | +XE_BO_FLAG_GGTT | +XE_BO_FLAG_PAGETABLE | +XE_BO_FLAG_SCANOUT , + alignment, false);if (IS_ERR (dpt))return PTR_ERR (dpt);
drivers/hid/hid-core.c +9 -2
@@ -379,6 +379,9 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsignstatic u32 item_udata (struct hid_item *item) { +if (item->format !=HID_ITEM_FORMAT_SHORT ) +return 0 ; +switch (item->size) {case 1 :return item->data.u8;case 2 :return item->data.u16;
@@ -389,6 +392,9 @@ static u32 item_udata(struct hid_item *item)static s32 item_sdata (struct hid_item *item) { +if (item->format !=HID_ITEM_FORMAT_SHORT ) +return 0 ; +switch (item->size) {case 1 :return item->data.s8;case 2 :return item->data.s16;
@@ -1925,13 +1931,14 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) size = field->report_size; -hid_dump_input (field->report->device, field->usage + offset, value); -if (offset >= field->report_count) {hid_err (field->report->device,"offset (%d) exceeds report_count (%d)\n" , offset, field->report_count);return -1 ; } + +hid_dump_input (field->report->device, field->usage + offset, value); +if (field->logical_minimum <0 ) {if (value !=snto32 (s32ton (value, size), size)) {hid_err (field->report->device,"value %d is out of range\n" , value);
drivers/hid/hid-hyperv.c +24 -3
@@ -171,18 +171,32 @@ static void mousevsc_free_device(struct mousevsc_dev *device) }static void mousevsc_on_receive_device_info (struct mousevsc_dev *input_device, -struct synthhid_device_info *device_info) +struct synthhid_device_info *device_info, +u32 device_info_size) {int ret =0 ;struct hid_descriptor *desc;struct mousevsc_prt_msg ack; +size_t desc_offset; +size_t desc_size; input_device->dev_info_status = -ENOMEM ; +if (device_info_size <sizeof (*device_info)) { + input_device->dev_info_status = -EINVAL ; + goto cleanup; + } + input_device->hid_dev_info = device_info->hid_dev_info; desc = &device_info->hid_descriptor; + desc_offset = offsetof(struct synthhid_device_info , hid_descriptor); + desc_size = device_info_size - desc_offset;if (desc->bLength ==0 ) goto cleanup; +if (desc->bLength <sizeof (*desc) || desc->bLength > desc_size) { + input_device->dev_info_status = -EINVAL ; + goto cleanup; + }/* The pointer is not NULL when we resume from hibernation */ kfree (input_device->hid_desc);
@@ -197,6 +211,10 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, input_device->dev_info_status = -EINVAL ; goto cleanup; } +if (input_device->report_desc_size > desc_size - desc->bLength) { + input_device->dev_info_status = -EINVAL ; + goto cleanup; + }/* The pointer is not NULL when we resume from hibernation */ kfree (input_device->report_desc);
@@ -273,14 +291,17 @@ static void mousevsc_on_receive(struct hv_device *device,break ;case SYNTH_HID_INITIAL_DEVICE_INFO : -WARN_ON (pipe_msg->size <sizeof (struct hv_input_dev_info )); +if (WARN_ON_ONCE (pipe_msg->size < +sizeof (struct synthhid_device_info ))) +break ;/* * Parse out the device info into device attr, * hid desc and report desc */ mousevsc_on_receive_device_info (input_dev, - (struct synthhid_device_info *)pipe_msg->data); + (struct synthhid_device_info *)pipe_msg->data, + pipe_msg->size);break ;case SYNTH_HID_INPUT_REPORT : input_report =
drivers/hid/hid-input.c +3 -0
@@ -374,6 +374,9 @@ static const struct hid_device_id hid_battery_quirks[] = { {HID_BLUETOOTH_DEVICE (USB_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICTRACKPAD ), HID_BATTERY_QUIRK_IGNORE }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, +USB_DEVICE_ID_APPLE_MAGICTRACKPAD2_USBC ), + HID_BATTERY_QUIRK_AVOID_QUERY }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM,USB_DEVICE_ID_ELECOM_BM084 ), HID_BATTERY_QUIRK_IGNORE },
drivers/hid/hid-magicmouse.c +63 -1
112 lines not on this page · raw message
drivers/hid/hid-nintendo.c +14 -8
@@ -2138,10 +2138,6 @@ static int joycon_input_create(struct joycon_ctlr *ctlr) ctlr->input->phys = hdev->phys;input_set_drvdata (ctlr->input, ctlr); - ret =input_register_device (ctlr->input); -if (ret) -return ret; -if (joycon_type_is_right_joycon (ctlr)) {joycon_config_right_stick (ctlr->input);joycon_config_buttons (ctlr->input, right_joycon_button_mappings);
@@ -2181,6 +2177,10 @@ static int joycon_input_create(struct joycon_ctlr *ctlr)if (joycon_has_rumble (ctlr))joycon_config_rumble (ctlr); + ret =input_register_device (ctlr->input); +if (ret) +return ret; +return 0 ; }
@@ -2559,7 +2559,12 @@ static int joycon_ctlr_read_handler(struct joycon_ctlr *ctlr, u8 *data, {if (data[0 ] ==JC_INPUT_SUBCMD_REPLY || data[0 ] ==JC_INPUT_IMU_DATA || data[0 ] ==JC_INPUT_MCU_DATA ) { -if (size >=12 )/* make sure it contains the input report */ +/* +* The whole struct is cast and parsed below, including the +* IMU/subcmd union, not just the 12-byte partial header this +* used to check for. +*/ +if (size >=sizeof (struct joycon_input_report ))joycon_parse_report (ctlr, (struct joycon_input_report *)data); }
@@ -2687,14 +2692,14 @@ static int nintendo_hid_probe(struct hid_device *hdev, ret =joycon_init (hdev);if (ret) {hid_err (hdev,"Failed to initialize controller; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; }/* Initialize the leds */ ret =joycon_leds_create (ctlr);if (ret) {hid_err (hdev,"Failed to create leds; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; }/* Initialize the battery power supply */
@@ -2717,7 +2722,8 @@ static int nintendo_hid_probe(struct hid_device *hdev, err_ida:ida_free (&nintendo_player_id_allocator, ctlr->player_id); -err_close: +err_io_stop: +hid_device_io_stop (hdev);hid_hw_close (hdev); err_stop:hid_hw_stop (hdev);
drivers/hid/hid-sensor-custom.c +9 -8
@@ -1005,26 +1005,26 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)return ret; } - ret =sysfs_create_group (&sensor_inst->pdev->dev.kobj, - &enable_sensor_attr_group); + ret =hid_sensor_custom_add_attributes (sensor_inst);if (ret) goto err_remove_callback; - ret =hid_sensor_custom_add_attributes (sensor_inst); + ret =sysfs_create_group (&sensor_inst->pdev->dev.kobj, + &enable_sensor_attr_group);if (ret) - goto err_remove_group; + goto err_remove_attributes; ret =hid_sensor_custom_dev_if_add (sensor_inst);if (ret) - goto err_remove_attributes; + goto err_remove_group;return 0 ; -err_remove_attributes: -hid_sensor_custom_remove_attributes (sensor_inst); err_remove_group:sysfs_remove_group (&sensor_inst->pdev->dev.kobj, &enable_sensor_attr_group); +err_remove_attributes: +hid_sensor_custom_remove_attributes (sensor_inst); err_remove_callback:sensor_hub_remove_callback (hsdev, hsdev->usage);
@@ -1042,9 +1042,10 @@ static void hid_sensor_custom_remove(struct platform_device *pdev) }hid_sensor_custom_dev_if_remove (sensor_inst); -hid_sensor_custom_remove_attributes (sensor_inst); +/* Remove enable_sensor first as it uses fields via power_state/report_state. */ sysfs_remove_group (&sensor_inst->pdev->dev.kobj, &enable_sensor_attr_group); +hid_sensor_custom_remove_attributes (sensor_inst);sensor_hub_remove_callback (hsdev, hsdev->usage); }
drivers/hid/hid-uclogic-core.c +11 -1
@@ -533,7 +533,17 @@ static void uclogic_remove(struct hid_device *hdev) {struct uclogic_drvdata *drvdata =hid_get_drvdata (hdev); -timer_delete_sync (&drvdata->inrange_timer); +/* +* Shut the in-range timer down before stopping the device. +* uclogic_raw_event_pen() re-arms inrange_timer on every pen report +* and keeps running until hid_hw_stop() stops the transport, so a +* plain timer_delete_sync() here can be undone by a report landing in +* the window before hid_hw_stop(). timer_shutdown_sync() cancels the +* timer and makes any later re-arm a no-op, so it is provably dead +* before hid_hw_stop() frees the input device drvdata->pen_input +* points at. +*/ +timer_shutdown_sync (&drvdata->inrange_timer);hid_hw_stop (hdev);kfree (drvdata->desc_ptr);uclogic_params_cleanup (&drvdata->params);
drivers/hid/usbhid/hid-pidff.c +10 -3
@@ -1520,13 +1520,20 @@ static int pidff_check_autocenter(struct pidff_device *pidff,int hid_pidff_init_with_quirks (struct hid_device *hid,u32 initial_quirks) {struct pidff_device *pidff; -struct hid_input *hidinput = - list_entry(hid->inputs.next, struct hid_input, list); -struct input_dev *dev = hidinput->input; +struct hid_input *hidinput; +struct input_dev *dev;struct ff_device *ff;int max_effects;int error; +if (list_empty (&hid->inputs)) { +hid_err (hid,"no inputs found\n" ); +return -ENODEV ; + } + + hidinput = list_first_entry(&hid->inputs, struct hid_input, list); + dev = hidinput->input; +hid_dbg (hid,"starting pid init\n" );if (list_empty (&hid->report_enum[HID_OUTPUT_REPORT ].report_list)) {
drivers/input/keyboard/atkbd.c +19 -4
@@ -1938,17 +1938,32 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { .callback = atkbd_deactivate_fixup, }, { - /* Lenovo Yoga Air 14 (83QK) */ .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_NAME, "83QK"), + DMI_MATCH(DMI_SYS_VENDOR, "HONOR"), + DMI_MATCH(DMI_PRODUCT_NAME, "BCC-N"), }, .callback = atkbd_deactivate_fixup, }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "HONOR"), - DMI_MATCH(DMI_PRODUCT_NAME, "BCC-N"), + DMI_MATCH(DMI_PRODUCT_NAME, "FMB-P"), + }, + .callback = atkbd_deactivate_fixup, + }, + { + /* HONOR MagicBook Pro 14 2026 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HONOR"), + DMI_MATCH(DMI_PRODUCT_NAME, "ZQC-P"), + }, + .callback = atkbd_deactivate_fixup, + }, + { + /* Lenovo Yoga Air 14 (83QK) */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83QK"), }, .callback = atkbd_deactivate_fixup, },
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +2 -0
@@ -4929,6 +4929,8 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev) {struct arm_smmu_device *smmu =platform_get_drvdata (pdev); +if (smmu->impl_ops && smmu->impl_ops->device_disable) + smmu->impl_ops->device_disable (smmu);arm_smmu_device_disable (smmu); }
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +1 -0
@@ -718,6 +718,7 @@ struct arm_smmu_strtab_cfg {struct arm_smmu_impl_ops {int (*device_reset)(struct arm_smmu_device *smmu); +void (*device_disable)(struct arm_smmu_device *smmu);void (*device_remove)(struct arm_smmu_device *smmu);int (*init_structures)(struct arm_smmu_device *smmu); struct arm_smmu_cmdq *(*get_secondary_cmdq)(
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +13 -2
@@ -763,8 +763,6 @@ static void tegra241_cmdqv_remove_vintf(struct tegra241_cmdqv *cmdqv, u16 idx)struct tegra241_vintf *vintf = cmdqv->vintfs[idx];u16 lidx; -tegra241_vintf_hw_deinit (vintf); -/* Remove LVCMDQ resources */ for (lidx =0 ; lidx < vintf->cmdqv->num_lvcmdqs_per_vintf; lidx++)if (vintf->lvcmdqs[lidx])
@@ -781,6 +779,17 @@ static void tegra241_cmdqv_remove_vintf(struct tegra241_cmdqv *cmdqv, u16 idx) } } +static void tegra241_cmdqv_hw_disable (struct arm_smmu_device *smmu) +{ +struct tegra241_cmdqv *cmdqv = + container_of(smmu, struct tegra241_cmdqv, smmu); +u16 idx; + +for (idx =0 ; idx < cmdqv->num_vintfs; idx++) +if (cmdqv->vintfs[idx]) +tegra241_vintf_hw_deinit (cmdqv->vintfs[idx]); +} +static void tegra241_cmdqv_remove (struct arm_smmu_device *smmu) { struct tegra241_cmdqv *cmdqv =
@@ -846,6 +855,7 @@ static struct arm_smmu_impl_ops tegra241_cmdqv_impl_ops = {/* For in-kernel use */ .get_secondary_cmdq = tegra241_cmdqv_get_cmdq, .device_reset = tegra241_cmdqv_hw_reset, + .device_disable = tegra241_cmdqv_hw_disable, .device_remove = tegra241_cmdqv_remove,/* For user-space use */ .hw_info = tegra241_cmdqv_hw_info,
@@ -1212,6 +1222,7 @@ static void tegra241_cmdqv_destroy_vintf_user(struct iommufd_viommu *viommu)if (vintf->mmap_offset)iommufd_viommu_destroy_mmap (&vintf->vsmmu.core, vintf->mmap_offset); +tegra241_vintf_hw_deinit (vintf);tegra241_cmdqv_remove_vintf (vintf->cmdqv, vintf->idx); }
drivers/iommu/iommufd/ioas.c +4 -0
@@ -541,6 +541,10 @@ int iommufd_ioas_change_process(struct iommufd_ucmd *ucmd)return rc;for_each_ioas_area (&ioas_list, index, ioas, area) { +if (!area->pages) { + rc = -EBUSY ; + goto out; + }if (area->pages->type !=IOPT_ADDRESS_FILE ) { rc = -EINVAL ; goto out;
drivers/mailbox/mailbox-mchp-ipc-sbi.c +2 -0
@@ -378,6 +378,8 @@ static int mchp_ipc_get_cluster_aggr_irq(struct mchp_ipc_sbi_mbox *ipc)for_each_online_cpu (cpuid) { hartid =cpuid_to_hartid_map (cpuid); irq_name =devm_kasprintf (ipc->dev,GFP_KERNEL ,"hart-%lu" , hartid); +if (!irq_name) +return -ENOMEM ; ret =platform_get_irq_byname_optional (pdev, irq_name);if (ret <=0 )continue ;
drivers/net/ethernet/pensando/ionic/ionic_lif.c +15 -2
@@ -918,8 +918,21 @@ static int ionic_lif_rxq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) };int err; - q->partner = &lif->txqcqs[q->index]->q; - q->partner->partner = q; + q->partner =NULL ; + +/* Only normal RX queues have matching TX queue partners. */ +if (q->index < lif->nxqs) { +if (!lif->txqcqs || + q->index >= lif->ionic->ntxqs_per_lif || + !lif->txqcqs[q->index]) { +dev_err (dev,"missing TX queue partner for RX queue %u\n" , + q->index); +return -ENXIO ; + } + + q->partner = &lif->txqcqs[q->index]->q; + q->partner->partner = q; + }if (!lif->xdp_prog || (lif->xdp_prog->aux && lif->xdp_prog->aux->xdp_has_frags))
drivers/net/ethernet/pensando/ionic/ionic_txrx.c +6 -1
@@ -545,13 +545,18 @@ static bool ionic_run_xdp(struct ionic_rx_stats *stats,break ;case XDP_TX : + txq = rxq->partner; +if (unlikely (!txq)) { + err = -EIO ; +break ; + } + xdpf =xdp_convert_buff_to_frame (&xdp_buf);if (!xdpf) { err = -ENOSPC ;break ; } - txq = rxq->partner; nq =netdev_get_tx_queue (netdev, txq->index);__netif_tx_lock (nq,smp_processor_id ());txq_trans_cond_update (nq);
drivers/net/usb/rndis_host.c +5 -1
@@ -14,6 +14,7 @@#include <linux/usb/cdc.h> #include <linux/usb/usbnet.h> #include <linux/usb/rndis_host.h> +#include <linux/overflow.h> /*
@@ -506,6 +507,7 @@ int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)struct rndis_data_hdr *hdr = (void *)skb->data;struct sk_buff *skb2;u32 msg_type, msg_len, data_offset, data_len; +u32 overflow_check; msg_type =le32_to_cpu (hdr->msg_type); msg_len =le32_to_cpu (hdr->msg_len);
@@ -514,7 +516,9 @@ int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)/* don't choke if we see oob, per-packet data, etc */ if (unlikely (msg_type !=RNDIS_MSG_PACKET || skb->len < msg_len - || (data_offset + data_len +8 ) > msg_len)) { + || (data_offset + data_len +8 ) > msg_len + ||check_add_overflow (data_offset, data_len, &overflow_check) + ||check_add_overflow (overflow_check,8 , &overflow_check))) { dev->net->stats.rx_frame_errors++; netdev_dbg(dev->net, "bad rndis message %d/%d/%d/%d, len %d\n", le32_to_cpu(hdr->msg_type),
drivers/nfc/fdp/i2c.c +27 -0
@@ -166,9 +166,36 @@ static int fdp_nci_i2c_read(struct fdp_i2c_phy *phy, struct sk_buff **skb)/* Packet that contains a length */ if (tmp[0 ] ==0 && tmp[1 ] ==0 ) { phy->next_read_size = (tmp[2 ] <<8 ) + tmp[3 ] +3 ; + +/* +* next_read_size is taken from the device and is used +* as the i2c_master_recv() count for the next packet +* and as the data skb size. A value above the receive +* buffer overflows tmp[]; one below the minimum frame +* size runs the header/LRC strip and the length-field +* read past a short receive. Either way the packet is +* corrupt: drop it and force resynchronization. +*/ +if (phy->next_read_size <FDP_NCI_I2C_MIN_PAYLOAD || + phy->next_read_size >FDP_NCI_I2C_MAX_PAYLOAD ) { +dev_dbg (&client->dev,"%s: corrupted packet\n" , + __func__); + phy->next_read_size =FDP_NCI_I2C_MIN_PAYLOAD ; + goto flush; + } }else { phy->next_read_size =FDP_NCI_I2C_MIN_PAYLOAD ; +/* +* Only one data packet is delivered per call; if the +* device sends another, do not overwrite and leak the +* skb allocated for the previous one. +*/ +if (*skb) { +kfree_skb (*skb); + *skb =NULL ; + } + *skb =alloc_skb (len,GFP_KERNEL );if (*skb ==NULL ) { r = -ENOMEM ;
drivers/nfc/microread/microread.c +29 -2
@@ -483,13 +483,19 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,switch (gate) {case MICROREAD_GATE_ID_MREAD_ISO_A : +if (skb->len <=MICROREAD_EMCF_A_LEN ) { + r = -EINVAL ; + goto exit_free; + } + targets->supported_protocols =nfc_hci_sak_to_protocol (skb->data[MICROREAD_EMCF_A_SAK ]); targets->sens_res =be16_to_cpu (*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA ]); targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK ]; targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN ]; -if (targets->nfcid1_len >sizeof (targets->nfcid1)) { +if (targets->nfcid1_len >sizeof (targets->nfcid1) || + targets->nfcid1_len > skb->len -MICROREAD_EMCF_A_UID ) { r = -EINVAL ; goto exit_free; }
@@ -497,13 +503,19 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, targets->nfcid1_len);break ;case MICROREAD_GATE_ID_MREAD_ISO_A_3 : +if (skb->len <=MICROREAD_EMCF_A3_LEN ) { + r = -EINVAL ; + goto exit_free; + } + targets->supported_protocols =nfc_hci_sak_to_protocol (skb->data[MICROREAD_EMCF_A3_SAK ]); targets->sens_res =be16_to_cpu (*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA ]); targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK ]; targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN ]; -if (targets->nfcid1_len >sizeof (targets->nfcid1)) { +if (targets->nfcid1_len >sizeof (targets->nfcid1) || + targets->nfcid1_len > skb->len -MICROREAD_EMCF_A3_UID ) { r = -EINVAL ; goto exit_free; }
@@ -511,11 +523,21 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, targets->nfcid1_len);break ;case MICROREAD_GATE_ID_MREAD_ISO_B : +if (skb->len <MICROREAD_EMCF_B_UID +4 ) { + r = -EINVAL ; + goto exit_free; + } + targets->supported_protocols =NFC_PROTO_ISO14443_B_MASK ;memcpy (targets->nfcid1, &skb->data[MICROREAD_EMCF_B_UID ],4 ); targets->nfcid1_len =4 ;break ;case MICROREAD_GATE_ID_MREAD_NFC_T1 : +if (skb->len <MICROREAD_EMCF_T1_UID +4 ) { + r = -EINVAL ; + goto exit_free; + } + targets->supported_protocols =NFC_PROTO_JEWEL_MASK ; targets->sens_res =le16_to_cpu (*(u16 *)&skb->data[MICROREAD_EMCF_T1_ATQA ]);
@@ -523,6 +545,11 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, targets->nfcid1_len =4 ;break ;case MICROREAD_GATE_ID_MREAD_NFC_T3 : +if (skb->len <MICROREAD_EMCF_T3_UID +8 ) { + r = -EINVAL ; + goto exit_free; + } + targets->supported_protocols =NFC_PROTO_FELICA_MASK ;memcpy (targets->nfcid1, &skb->data[MICROREAD_EMCF_T3_UID ],8 ); targets->nfcid1_len =8 ;
drivers/nfc/pn533/pn533.c +1 -0
@@ -2799,6 +2799,7 @@ void pn53x_common_clean(struct pn533 *priv)destroy_workqueue (priv->wq);skb_queue_purge (&priv->resp_q); +skb_queue_purge (&priv->fragment_skb);list_for_each_entry_safe (cmd, n, &priv->cmd_queue, queue) {list_del (&cmd->queue);
drivers/nfc/st21nfca/dep.c +3 -0
@@ -205,6 +205,9 @@ static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev,if (atr_req->length <sizeof (struct st21nfca_atr_req ))return -EPROTO ; +if (atr_req->length > skb->len) +return -EPROTO ; + r =st21nfca_tm_send_atr_res (hdev, atr_req);if (r)return r;
drivers/nvme/target/admin-cmd.c +1 -1
@@ -963,7 +963,7 @@ static void nvmet_execute_identify_nslist(struct nvmet_req *req, bool match_css)nvmet_for_each_enabled_ns (&ctrl->subsys->namespaces, idx, ns) {if (ns->nsid <= min_nsid)continue ; -if (match_css && req->ns->csi != req->cmd->identify.csi) +if (match_css && ns->csi != req->cmd->identify.csi)continue ; list[i++] =cpu_to_le32 (ns->nsid);if (i == buf_size /sizeof (__le32))
drivers/nvme/target/fabrics-cmd-auth.c +1 -1
@@ -558,7 +558,7 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)return ; } - d =kmalloc (al,GFP_KERNEL ); + d =kzalloc (al,GFP_KERNEL );if (!d) { status =NVME_SC_INTERNAL ; goto done;
drivers/nvme/target/fc.c +1 -1
@@ -569,7 +569,7 @@ nvmet_fc_alloc_ls_iodlist(struct nvmet_fc_tgtport *tgtport)list_del (&iod->ls_rcv_list); } -kfree (iod); +kfree (tgtport->iod);return -EFAULT ; }
drivers/nvme/target/pci-epf.c +7 -3
@@ -1338,6 +1338,7 @@ static u16 nvmet_pci_epf_create_cq(struct nvmet_ctrl *tctrl,nvmet_pci_epf_mem_unmap (ctrl->nvme_epf, &cq->pci_map); err_internal: status =NVME_SC_INTERNAL |NVME_STATUS_DNR ; +nvmet_cq_put (&cq->nvme_cq); err:if (test_and_clear_bit (NVMET_PCI_EPF_Q_IRQ_ENABLED , &cq->flags))nvmet_pci_epf_remove_irq_vector (ctrl, cq->vector);
@@ -1595,6 +1596,7 @@ static void nvmet_pci_epf_exec_iod_work(struct work_struct *work)struct nvmet_pci_epf_iod *iod = container_of(work, struct nvmet_pci_epf_iod, work);struct nvmet_req *req = &iod->req; +bool no_wait;int ret;if (!iod->ctrl->link_up) {
@@ -1639,14 +1641,16 @@ static void nvmet_pci_epf_exec_iod_work(struct work_struct *work) } } - req->execute (req); -/* * If we do not have data to transfer after the command execution * finishes, nvmet_pci_epf_queue_response() will complete the command * directly. No need to wait for the completion in this case. */ -if (!iod->data_len || iod->dma_dir !=DMA_TO_DEVICE ) + no_wait = !iod->data_len || iod->dma_dir !=DMA_TO_DEVICE ; + + req->execute (req); + +if (no_wait)return ;wait_for_completion (&iod->done);
drivers/nvme/target/tcp.c +16 -2
@@ -433,6 +433,19 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd)if (!len)return 0 ; +/* +* inline_data_size only bounds the in-capsule (type 0x01) SGL +* descriptor below. A non-inline transport SGL data-block +* descriptor skips that check entirely and would otherwise reach +* sgl_alloc() with an attacker-controlled len of up to 4 GiB, +* pinning that much kernel memory for a command that may never +* complete. Bound every descriptor type here, before allocating +* anything, using the same ceiling this file already applies to +* per-PDU H2C data. +*/ +if (len >NVMET_TCP_MAXH2CDATA ) +return NVME_SC_SGL_INVALID_DATA |NVME_STATUS_DNR ; +if (sgl->type == ((NVME_SGL_FMT_DATA_DESC <<4 ) |NVME_SGL_FMT_OFFSET )) {if (!nvme_is_write (cmd->req.cmd))
@@ -444,14 +457,15 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd) } cmd->req.transfer_len += len; - cmd->req.sg =sgl_alloc (len,GFP_KERNEL , &cmd->req.sg_cnt); + cmd->req.sg =sgl_alloc (len,GFP_KERNEL | __GFP_NOWARN, + &cmd->req.sg_cnt);if (!cmd->req.sg)return NVME_SC_INTERNAL ; cmd->cur_sg = cmd->req.sg;if (nvmet_tcp_has_data_in (cmd)) { cmd->iov =kmalloc_array (cmd->req.sg_cnt, -sizeof (*cmd->iov),GFP_KERNEL ); +sizeof (*cmd->iov),GFP_KERNEL | __GFP_NOWARN);if (!cmd->iov) goto err; }
drivers/pci/controller/pci-host-generic.c +1 -10
@@ -16,15 +16,6 @@#include "pci-host-common.h" -static const struct pci_ecam_ops gen_pci_cfg_cam_bus_ops = { - .bus_shift =16 , - .pci_ops = { - .map_bus = pci_ecam_map_bus, - .read = pci_generic_config_read, - .write = pci_generic_config_write, - } -}; -static bool pci_dw_valid_device (struct pci_bus *bus,unsigned int devfn) {struct pci_config_window *cfg = bus->sysdata;
@@ -60,7 +51,7 @@ static const struct pci_ecam_ops pci_dw_ecam_bus_ops = {static const struct of_device_id gen_pci_of_match[] = { { .compatible ="pci-host-cam-generic" , - .data = &gen_pci_cfg_cam_bus_ops }, + .data = &pci_generic_cam_ops }, { .compatible ="pci-host-ecam-generic" , .data = &pci_generic_ecam_ops },
drivers/pci/ecam.c +13 -0
@@ -208,6 +208,19 @@ const struct pci_ecam_ops pci_generic_ecam_ops = { };EXPORT_SYMBOL_GPL (pci_generic_ecam_ops); +/* CAM ops */ +const struct pci_ecam_ops pci_generic_cam_ops = { + .bus_shift =16 , + .pci_ops = { + .add_bus = pci_ecam_add_bus, + .remove_bus = pci_ecam_remove_bus, + .map_bus = pci_ecam_map_bus, + .read = pci_generic_config_read, + .write = pci_generic_config_write, + } +}; +EXPORT_SYMBOL_GPL (pci_generic_cam_ops); +#if defined(CONFIG_ACPI ) && defined(CONFIG_PCI_QUIRKS )/* ECAM ops for 32-bit access only (non-compliant) */ const struct pci_ecam_ops pci_32b_ops = {
drivers/ptp/ptp_vmclock.c +6 -0
@@ -365,6 +365,12 @@ static int vmclock_miscdev_mmap(struct file *fp, struct vm_area_struct *vma)if ((vma->vm_flags & (VM_READ |VM_WRITE )) !=VM_READ )return -EROFS ; +/* +* Restrict the read-only mapping so it cannot be upgraded to +* writable later with mprotect(). +*/ +vm_flags_clear (vma,VM_MAYWRITE ); +if (vma->vm_end - vma->vm_start !=PAGE_SIZE || vma->vm_pgoff)return -EINVAL ;
drivers/tty/serial/sc16is7xx.c +18 -22
@@ -11,6 +11,7 @@#define DEFAULT_SYMBOL_NAMESPACE "SERIAL_NXP_SC16IS7XX"#include <linux/bits.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/device.h>
@@ -328,7 +329,7 @@ struct sc16is7xx_one_config {struct sc16is7xx_one {struct uart_port port;struct regmap *regmap; -struct mutex efr_lock;/* EFR registers access */ +struct mutex lock;/* For registers sharing same address space. */ struct kthread_work tx_work;struct kthread_work reg_work;struct kthread_delayed_work ms_work;
@@ -436,7 +437,7 @@ static void sc16is7xx_efr_lock(struct uart_port *port) {struct sc16is7xx_one *one =to_sc16is7xx_one (port, port); -mutex_lock (&one->efr_lock); +mutex_lock (&one->lock);/* Backup content of LCR. */ one->old_lcr =sc16is7xx_port_read (port,SC16IS7XX_LCR_REG );
@@ -458,7 +459,7 @@ static void sc16is7xx_efr_unlock(struct uart_port *port)/* Restore original content of LCR */ sc16is7xx_port_write (port,SC16IS7XX_LCR_REG , one->old_lcr); -mutex_unlock (&one->efr_lock); +mutex_unlock (&one->lock); }static void sc16is7xx_ier_clear (struct uart_port *port,u8 bit)
@@ -593,7 +594,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)SC16IS7XX_MCR_CLKSEL_BIT , prescaler == 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT); -mutex_lock (&one->efr_lock); +mutex_lock (&one->lock);/* Backup LCR and access special register set (DLL/DLH) */ lcr =sc16is7xx_port_read (port,SC16IS7XX_LCR_REG );
@@ -609,7 +610,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)/* Restore LCR and access to general register set */ sc16is7xx_port_write (port,SC16IS7XX_LCR_REG , lcr); -mutex_unlock (&one->efr_lock); +mutex_unlock (&one->lock);return DIV_ROUND_CLOSEST ((clk / prescaler) /16 , div); }
@@ -756,7 +757,7 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_one *one)unsigned long flags;unsigned int status, changed; -lockdep_assert_held_once (&one->efr_lock); +lockdep_assert_held_once (&one->lock); status =sc16is7xx_get_hwmctrl (port); changed = status ^ one->old_mctrl;
@@ -782,18 +783,15 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_one *one)static bool sc16is7xx_port_irq (struct sc16is7xx_port *s,int portno) { -bool rc = true;unsigned int iir, rxlen;struct uart_port *port = &s->p[portno].port;struct sc16is7xx_one *one =to_sc16is7xx_one (port, port); -mutex_lock (&one->efr_lock); +guard (mutex)(&one->lock); iir =sc16is7xx_port_read (port,SC16IS7XX_IIR_REG ); -if (iir &SC16IS7XX_IIR_NO_INT_BIT ) { - rc = false; - goto out_port_irq; - } +if (iir &SC16IS7XX_IIR_NO_INT_BIT ) +return false; iir &=SC16IS7XX_IIR_ID_MASK ;
@@ -833,10 +831,7 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)break ; } -out_port_irq: -mutex_unlock (&one->efr_lock); - -return rc; +return true; }static irqreturn_t sc16is7xx_irq (int irq,void *dev_id)
@@ -878,9 +873,11 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws) (port->rs485.delay_rts_before_send > 0))msleep (port->rs485.delay_rts_before_send); -mutex_lock (&one->efr_lock); +guard (mutex)(&one->lock); +sc16is7xx_port_update (port,SC16IS7XX_IER_REG , +SC16IS7XX_IER_THRI_BIT , +SC16IS7XX_IER_THRI_BIT );sc16is7xx_handle_tx (port); -mutex_unlock (&one->efr_lock); }static void sc16is7xx_reconf_rs485 (struct uart_port *port)
@@ -947,9 +944,8 @@ static void sc16is7xx_ms_proc(struct kthread_work *ws)struct sc16is7xx_port *s =dev_get_drvdata (one->port.dev);if (one->port.state) { -mutex_lock (&one->efr_lock); -sc16is7xx_update_mlines (one); -mutex_unlock (&one->efr_lock); + scoped_guard(mutex, &one->lock) +sc16is7xx_update_mlines (one);kthread_queue_delayed_work (&s->kworker, &one->ms_work,HZ ); }
@@ -1635,7 +1631,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, s->p[i].old_mctrl =0 ; s->p[i].regmap = regmaps[i]; -mutex_init (&s->p[i].efr_lock); +mutex_init (&s->p[i].lock); ret =uart_get_rs485_mode (&s->p[i].port);if (ret)
fs/exec.c +6 -2
@@ -30,6 +30,7 @@#include <linux/mm.h> #include <linux/stat.h> #include <linux/fcntl.h> +#include <linux/futex.h> #include <linux/swap.h> #include <linux/string.h> #include <linux/init.h>
@@ -851,6 +852,7 @@ static int exec_mmap(struct mm_struct *mm)/* Notify parent that we're no longer interested in the old VM */ tsk = current; old_mm = current->mm; +/* Clean up futexes and release the mm */ exec_mm_release (tsk, old_mm); ret =down_write_killable (&tsk->signal->exec_update_lock);
@@ -899,9 +901,11 @@ static int exec_mmap(struct mm_struct *mm)setmax_mm_hiwater_rss (&tsk->signal->maxrss, old_mm);mm_update_next_owner (old_mm);mmput (old_mm); -return 0 ; + }else { +mmdrop_lazy_tlb (active_mm); } -mmdrop_lazy_tlb (active_mm); + +futex_exec_done (tsk);return 0 ; }
fs/ext4/crypto.c +20 -20
@@ -144,7 +144,13 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,if (inode->i_ino ==EXT4_ROOT_INO )return -EPERM ; -if (WARN_ON_ONCE (IS_DAX (inode) &&i_size_read (inode))) +/* +* For new encrypted inodes, S_DAX is never set in the first place. +* +* For existing inodes, this is called only on empty directories. ext4 +* never sets S_DAX on directories. +*/ +if (WARN_ON_ONCE (IS_DAX (inode)))return -EINVAL ;if (ext4_test_inode_flag (inode,EXT4_INODE_DAX ))
@@ -163,6 +169,14 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,*/ if (handle) { +/* +* __ext4_new_inode() should have already set the encrypt flag +* on the inode and avoided enabling inline data. +*/ +if (WARN_ON_ONCE (!IS_ENCRYPTED (inode))) +return -EINVAL ; +if (WARN_ON_ONCE (ext4_test_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA ))) +return -EINVAL ;/* * Since the inode is new it is ok to pass the * XATTR_CREATE flag. This is necessary to match the
@@ -170,21 +184,10 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,* function with the credits allocated for the new * inode. */ - res =ext4_xattr_set_handle (handle, inode, -EXT4_XATTR_INDEX_ENCRYPTION , -EXT4_XATTR_NAME_ENCRYPTION_CONTEXT , - ctx, len,XATTR_CREATE ); -if (!res) { -ext4_set_inode_flag (inode,EXT4_INODE_ENCRYPT ); -ext4_clear_inode_state (inode, -EXT4_STATE_MAY_INLINE_DATA ); -/* -* Update inode->i_flags - S_ENCRYPTED will be enabled, -* S_DAX may be disabled -*/ -ext4_set_inode_flags (inode, false); - } -return res; +return ext4_xattr_set_handle (handle, inode, +EXT4_XATTR_INDEX_ENCRYPTION , +EXT4_XATTR_NAME_ENCRYPTION_CONTEXT , + ctx, len,XATTR_CREATE ); } res =dquot_initialize (inode);
@@ -205,10 +208,7 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, ctx, len, 0);if (!res) {ext4_set_inode_flag (inode,EXT4_INODE_ENCRYPT ); -/* -* Update inode->i_flags - S_ENCRYPTED will be enabled, -* S_DAX may be disabled -*/ +/* Update inode->i_flags to set S_ENCRYPTED. */ ext4_set_inode_flags (inode, false); res =ext4_mark_inode_dirty (handle, inode);if (res)
fs/ext4/fast_commit.c +12 -4
@@ -1797,8 +1797,11 @@ static int ext4_fc_replay_add_range(struct super_block *sb,if (ret ==0 ) {/* Range is not mapped */ path =ext4_find_extent (inode, cur, path,0 ); -if (IS_ERR (path)) +if (IS_ERR (path)) { + ret =PTR_ERR (path); + path =NULL ; goto out; + }memset (&newex,0 ,sizeof (newex)); newex.ee_block =cpu_to_le32 (cur); ext4_ext_store_pblock(
@@ -1810,8 +1813,11 @@ static int ext4_fc_replay_add_range(struct super_block *sb, path =ext4_ext_insert_extent (NULL , inode, path, &newex,0 );up_write ((&EXT4_I (inode)->i_data_sem)); -if (IS_ERR (path)) +if (IS_ERR (path)) { + ret =PTR_ERR (path); + path =NULL ; goto out; + } goto next; }
@@ -1858,10 +1864,11 @@ static int ext4_fc_replay_add_range(struct super_block *sb, }ext4_ext_replay_shrink_inode (inode,i_size_read (inode) >> sb->s_blocksize_bits); + ret =0 ; out:ext4_free_ext_path (path);iput (inode); -return 0 ; +return ret; }/* Replay DEL_RANGE tag */
@@ -1922,9 +1929,10 @@ ext4_fc_replay_del_range(struct super_block *sb,ext4_ext_replay_shrink_inode (inode,i_size_read (inode) >> sb->s_blocksize_bits);ext4_mark_inode_dirty (NULL , inode); + ret =0 ; out:iput (inode); -return 0 ; +return ret; }static void ext4_fc_set_bitmaps_and_counters (struct super_block *sb)
fs/ext4/ialloc.c +4 -0
@@ -995,6 +995,8 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap, err =fscrypt_prepare_new_inode (dir, inode, &encrypt);if (err) goto out; +if (encrypt) + i_flags |=EXT4_ENCRYPT_FL ; } err =dquot_initialize (inode);
@@ -1304,6 +1306,8 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap, ei->i_extra_isize = sbi->s_want_extra_isize; ei->i_inline_off =0 ;if (ext4_has_feature_inline_data (sb) && +/* Encrypted inodes cannot have inline data */ + !(ei->i_flags &EXT4_ENCRYPT_FL ) && (!(ei->i_flags & (EXT4_DAX_FL |EXT4_EA_INODE_FL )) ||S_ISDIR (mode)))ext4_set_inode_state (inode,EXT4_STATE_MAY_INLINE_DATA ); ret = inode;
fs/ext4/inode.c +6 -5
@@ -1179,6 +1179,7 @@ int ext4_block_write_begin(handle_t *handle, struct folio *folio,int nr_wait =0 ;int i;bool should_journal_data =ext4_should_journal_data (inode); +bool folio_uptodate =folio_test_uptodate (folio);BUG_ON (!folio_test_locked (folio));BUG_ON (to >folio_size (folio));
@@ -1190,13 +1191,13 @@ int ext4_block_write_begin(handle_t *handle, struct folio *folio, bbits =ilog2 (blocksize); block = (sector_t )folio->index << (PAGE_SHIFT - bbits); -for (bh = head, block_start =0 ; bh != head || !block_start; +for (bh = head, block_start =0 ; + block_start < to || (!folio_uptodate && bh != head); block++, block_start = block_end, bh = bh->b_this_page) { block_end = block_start + blocksize;if (block_end <= from || block_start >= to) { -if (folio_test_uptodate (folio)) { +if (folio_uptodate)set_buffer_uptodate (bh); - }continue ; }if (WARN_ON_ONCE (buffer_new (bh)))
@@ -1217,7 +1218,7 @@ int ext4_block_write_begin(handle_t *handle, struct folio *folio,if (should_journal_data)do_journal_get_write_access (handle, inode, bh); -if (folio_test_uptodate (folio)) { +if (folio_uptodate) {/* * Unlike __block_write_begin() we leave * dirtying of new uptodate buffers to
@@ -1234,7 +1235,7 @@ int ext4_block_write_begin(handle_t *handle, struct folio *folio,continue ; } } -if (folio_test_uptodate (folio)) { +if (folio_uptodate) {set_buffer_uptodate (bh);continue ; }
fs/ext4/super.c +1 -1
@@ -5291,7 +5291,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)ext4_set_def_opts (sb, es); sbi->s_resuid =make_kuid (&init_user_ns,ext4_get_resuid (es)); - sbi->s_resgid =make_kgid (&init_user_ns,ext4_get_resuid (es)); + sbi->s_resgid =make_kgid (&init_user_ns,ext4_get_resgid (es)); sbi->s_commit_interval =JBD2_DEFAULT_MAX_COMMIT_AGE *HZ ; sbi->s_min_batch_time =EXT4_DEF_MIN_BATCH_TIME ; sbi->s_max_batch_time =EXT4_DEF_MAX_BATCH_TIME ;
fs/ext4/xattr.c +5 -2
@@ -2075,12 +2075,13 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,* stable so we can check the additional * reference fits. */ - ref =le32_to_cpu (BHDR (new_bh)->h_refcount) +1 ; -if (ref >EXT4_XATTR_REFCOUNT_MAX ) { + ref =le32_to_cpu (BHDR (new_bh)->h_refcount); +if (ref >=EXT4_XATTR_REFCOUNT_MAX ) {/* * Undo everything and check mbcache * again. */ +clear_bit (MBE_REUSABLE_B , &ce->e_flags);unlock_buffer (new_bh); dquot_free_block(inode, EXT4_C2B(EXT4_SB(sb),
@@ -2091,6 +2092,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, new_bh =NULL ; goto inserted; } + ref++;BHDR (new_bh)->h_refcount =cpu_to_le32 (ref);if (ref ==EXT4_XATTR_REFCOUNT_MAX )clear_bit (MBE_REUSABLE_B , &ce->e_flags);
@@ -2839,6 +2841,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, s_min_extra_isize) { tried_min_extra_isize++; new_extra_isize = s_min_extra_isize; + error =0 ; goto retry; } goto cleanup;
fs/nilfs2/ioctl.c +18 -2
@@ -527,6 +527,7 @@ static int nilfs_ioctl_get_bdescs(struct inode *inode, struct file *filp,* Return: 0 on success, or one of the following negative error codes on * failure: * * %-EEXIST - Block conflict detected. +* * %-EINVAL - Invalid virtual block descriptor. * * %-EIO - I/O error. * * %-ENOENT - Requested block doesn't exist. * * %-ENOMEM - Insufficient memory available.
@@ -536,15 +537,30 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode, struct list_head *buffers) {struct buffer_head *bh; +__u64 limit_blkidx = (__u64 )inode->i_sb->s_maxbytes >> inode->i_blkbits;int ret; -if (vdesc->vd_flags ==0 ) +/* +* vblocknr 0 is reserved as an invalid pointer. Also, limit_blkidx +* ensures that the page index converted from vd_vblocknr never +* overflows the page cache limit and respects the architecture's bmap +* key width. +*/ +if (unlikely (vdesc->vd_vblocknr ==0 || + vdesc->vd_vblocknr >= limit_blkidx)) +return -EINVAL ; + +if (vdesc->vd_flags ==0 ) { +if (unlikely (vdesc->vd_offset >= limit_blkidx)) +return -EINVAL ; + ret =nilfs_gccache_submit_read_data ( inode, vdesc->vd_offset, vdesc->vd_blocknr, vdesc->vd_vblocknr, &bh); -else + }else { ret =nilfs_gccache_submit_read_node ( inode, vdesc->vd_blocknr, vdesc->vd_vblocknr, &bh); + }if (unlikely (ret <0 )) {if (ret == -ENOENT )
fs/ocfs2/xattr.c +12 -6
@@ -736,12 +736,10 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode, prev_clusters;if (why !=RESTART_NONE && clusters_to_add) { -/* -* We can only fail in case the alloc file doesn't give -* up enough clusters. -*/ -BUG_ON (why ==RESTART_META ); - +if (why ==RESTART_META ) { + status = -ENOSPC ; +break ; + } credits =ocfs2_calc_extend_credits (inode->i_sb, &vb->vb_xv->xr_list); status =ocfs2_extend_trans (handle, credits);
@@ -3210,6 +3208,14 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode, }else credits +=OCFS2_SUBALLOC_ALLOC +1 ; +/* +* Reserve metadata for the new xattr's value extent tree. +* The not_found path above adds credits for this tree but +* omits meta_add, leaving meta_ac NULL for large values. +*/ +if (xi->xi_value_len >OCFS2_XATTR_INLINE_SIZE ) + meta_add +=ocfs2_extend_meta_needed (&def_xv.xv.xr_list); +/* * This cluster will be used either for new bucket or for * new xattr block.
fs/xfs/libxfs/xfs_attr_leaf.c +14 -0
@@ -268,6 +268,13 @@ xfs_attr3_leaf_verify_entry(*/ if (ent->flags &XFS_ATTR_LOCAL ) { lentry =xfs_attr3_leaf_name_local (leaf, idx); + +/* Validate lentry pointer is within bounds before field access */ +if ((char *)lentry >= buf_end) +return __this_address; +if ((char *)lentry + offsetof(struct xfs_attr_leaf_name_local , nameval) > buf_end) +return __this_address; + namesize =xfs_attr_leaf_entsize_local (lentry->namelen,be16_to_cpu (lentry->valuelen)); name_end = (char *)lentry + namesize;
@@ -275,6 +282,13 @@ xfs_attr3_leaf_verify_entry(return __this_address; }else { rentry =xfs_attr3_leaf_name_remote (leaf, idx); + +/* Validate rentry pointer is within bounds before field access */ +if ((char *)rentry >= buf_end) +return __this_address; +if ((char *)rentry + offsetof(struct xfs_attr_leaf_name_remote , name) > buf_end) +return __this_address; + namesize =xfs_attr_leaf_entsize_remote (rentry->namelen); name_end = (char *)rentry + namesize;if (rentry->namelen ==0 )
fs/xfs/scrub/agheader.c +72 -24
126 lines not on this page · raw message
fs/xfs/scrub/agheader_repair.c +15 -2
@@ -1096,18 +1096,22 @@ xrep_iunlink_walk_ondisk_bucket( struct xrep_agi *ragi, unsigned int bucket) { +struct xagino_bitmap seen;struct xfs_scrub *sc = ragi->sc;struct xfs_agi *agi = ragi->agi_bp->b_addr;xfs_agino_t prev_agino =NULLAGINO ;xfs_agino_t next_agino;int error =0 ; +xagino_bitmap_init (&seen); + next_agino =be32_to_cpu (agi->agi_unlinked[bucket]);while (next_agino !=NULLAGINO ) {xfs_agino_t agino = next_agino; +unsigned int len =1 ;if (xchk_should_terminate (ragi->sc, &error)) -return error; + goto out_bitmap;trace_xrep_iunlink_walk_ondisk_bucket (sc->sa.pag, bucket, prev_agino, agino);
@@ -1115,6 +1119,9 @@ xrep_iunlink_walk_ondisk_bucket(if (bucket != agino %XFS_AGI_UNLINKED_BUCKETS )break ; +if (xagino_bitmap_test (&seen, agino, &len)) +break ; + next_agino =xrep_iunlink_next (sc, agino);if (!next_agino) { error = xrep_iunlink_reload_next(ragi, prev_agino,
@@ -1123,10 +1130,16 @@ xrep_iunlink_walk_ondisk_bucket(break ; } + error =xagino_bitmap_set (&seen, agino,1 ); +if (error) + goto out_bitmap; + prev_agino = agino; } -return 0 ; +out_bitmap: +xagino_bitmap_destroy (&seen); +return error; }/* Decide if this is an unlinked inode in this AG. */
fs/xfs/scrub/bmap.c +4 -4
@@ -1040,7 +1040,7 @@ xchk_bmap(case XFS_COW_FORK :/* No CoW forks filesystem doesn't support out of place writes */ if (!xfs_has_reflink (mp) && !xfs_has_zoned (mp)) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }break ;
@@ -1052,7 +1052,7 @@ xchk_bmap(* attr here. */ if (!xfs_has_attr (mp)) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);break ;default :ASSERT (whichfork ==XFS_DATA_FORK );
@@ -1137,7 +1137,7 @@ xchk_bmap_data(int error;if (xchk_file_looks_zapped (sc,XFS_SICK_INO_BMBTD_ZAPPED )) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }
@@ -1165,7 +1165,7 @@ xchk_bmap_attr(* returning immediately. */ if (xchk_file_looks_zapped (sc,XFS_SICK_INO_BMBTA_ZAPPED )) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }
fs/xfs/scrub/common.c +5 -5
@@ -1099,7 +1099,7 @@ xchk_install_live_inode( struct xfs_inode *ip) {if (!igrab (VFS_I (ip))) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip);return -EFSCORRUPTED ; }
@@ -1428,13 +1428,13 @@ xchk_metadata_inode_forks(/* Metadata inodes don't live on the rt device. */ if (sc->ip->i_diflags &XFS_DIFLAG_REALTIME ) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }/* They should never participate in reflink. */ if (xfs_is_reflink_inode (sc->ip)) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }
@@ -1451,7 +1451,7 @@ xchk_metadata_inode_forks( &error))return error;if (shared) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip); }/*
@@ -1460,7 +1460,7 @@ xchk_metadata_inode_forks(*/ if (xfs_inode_hasattr (sc->ip)) {if (!xfs_has_metadir (sc->mp)) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }
fs/xfs/scrub/common.h +2 -0
@@ -30,6 +30,8 @@ void xchk_set_corrupt(struct xfs_scrub *sc);void xchk_block_set_corrupt (struct xfs_scrub *sc,struct xfs_buf *bp);void xchk_ino_set_corrupt (struct xfs_scrub *sc,xfs_ino_t ino); +#define xchk_ip_set_corrupt (_sc, _ip) \ + xchk_ino_set_corrupt((_sc), (_ip)->i_ino)void xchk_fblock_set_corrupt (struct xfs_scrub *sc,int whichfork,xfs_fileoff_t offset);#ifdef CONFIG_XFS_QUOTA
fs/xfs/scrub/dir.c +1 -1
@@ -1075,7 +1075,7 @@ xchk_directory(/* Plausible size? */ if (sc->ip->i_disk_size <xfs_dir2_sf_hdr_size (0 )) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }
fs/xfs/scrub/dirtree.c +2 -2
@@ -979,10 +979,10 @@ xchk_dirtree(xchk_dirtree_evaluate (dl, &oc);if (xchk_dirtree_parentless (dl)) {if (oc.good || oc.bad || oc.suspect) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip); }else {if (oc.bad || oc.good + oc.suspect !=1 ) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);if (oc.suspect)xchk_ino_xref_set_corrupt (sc, sc->ip->i_ino); }
fs/xfs/scrub/metapath.c +3 -3
@@ -314,7 +314,7 @@ xchk_metapath(/* Parent required to do anything else. */ if (mpath->dp ==NULL ) { -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);return 0 ; }
@@ -329,7 +329,7 @@ xchk_metapath(trace_xchk_metapath_lookup (sc, mpath->path, mpath->dp, ino);if (error == -ENOENT ) {/* No directory entry at all */ -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip); error =0 ; goto out_ilock; }
@@ -337,7 +337,7 @@ xchk_metapath( goto out_ilock;if (ino != sc->ip->i_ino) {/* Pointing to wrong inode */ -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip); } out_ilock:
fs/xfs/scrub/nlinks.c +6 -6
@@ -719,7 +719,7 @@ xchk_nlinks_compare_inode(* count, but it will let them decrease it. */ if (total_links >XFS_NLINK_PINNED ) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip); goto out_corrupt; }else if (total_links >XFS_MAXLINK ) {xchk_ino_set_warning (sc, ip->i_ino);
@@ -727,7 +727,7 @@ xchk_nlinks_compare_inode(/* Link counts should match. */ if (total_links != actual_nlink) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip); goto out_corrupt; }
@@ -748,7 +748,7 @@ xchk_nlinks_compare_inode(* back references. */ if (obs.backrefs !=0 ) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip); goto out_corrupt; }
@@ -757,7 +757,7 @@ xchk_nlinks_compare_inode(* children. */ if (obs.children !=0 ) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip); goto out_corrupt; } }
@@ -770,7 +770,7 @@ xchk_nlinks_compare_inode(* the root directory. */ if (obs.parents !=1 ) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip); goto out_corrupt; } }else if (actual_nlink >0 ) {
@@ -779,7 +779,7 @@ xchk_nlinks_compare_inode(* least one parent. */ if (obs.parents ==0 ) { -xchk_ino_set_corrupt (sc, ip->i_ino); +xchk_ip_set_corrupt (sc, ip); goto out_corrupt; } }
fs/xfs/scrub/parent.c +3 -3
@@ -729,10 +729,10 @@ xchk_parent_count_pptrs( pp->pptrs_found++;if (VFS_I (sc->ip)->i_nlink ==0 && pp->pptrs_found >0 ) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip);else if (VFS_I (sc->ip)->i_nlink >0 && pp->pptrs_found ==0 ) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip); }else {/* * Starting with metadir, we allow checking of parent pointers
@@ -743,7 +743,7 @@ xchk_parent_count_pptrs( pp->pptrs_found++;if (VFS_I (sc->ip)->i_nlink != pp->pptrs_found) -xchk_ino_set_corrupt (sc, sc->ip->i_ino); +xchk_ip_set_corrupt (sc, sc->ip); }return 0 ;
fs/xfs/scrub/rtbitmap.c +6 -6
@@ -200,13 +200,13 @@ xchk_rtbitmap(/* Is sb_rextents correct? */ if (mp->m_sb.sb_rextents != rtb->rextents) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }/* Is sb_rextslog correct? */ if (mp->m_sb.sb_rextslog != rtb->rextslog) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }
@@ -215,17 +215,17 @@ xchk_rtbitmap(* case can we exceed 4bn bitmap blocks since the super field is a u32. */ if (rtb->rbmblocks >U32_MAX ) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }if (mp->m_sb.sb_rbmblocks != rtb->rbmblocks) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }/* The bitmap file length must be aligned to an fsblock. */ if (rbmip->i_disk_size & mp->m_blockmask) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }
@@ -235,7 +235,7 @@ xchk_rtbitmap(* file can be larger than sb_rbmblocks. */ if (rbmip->i_disk_size <XFS_FSB_TO_B (mp, rtb->rbmblocks)) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }
fs/xfs/scrub/rtsummary.c +6 -6
@@ -315,25 +315,25 @@ xchk_rtsummary(/* Is sb_rextents correct? */ if (mp->m_sb.sb_rextents != rts->rextents) { -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ip_set_corrupt (sc, rbmip);return 0 ; }/* Is m_rsumlevels correct? */ if (mp->m_rsumlevels != rts->rsumlevels) { -xchk_ino_set_corrupt (sc, rsumip->i_ino); +xchk_ip_set_corrupt (sc, rsumip);return 0 ; }/* Is m_rsumsize correct? */ if (mp->m_rsumblocks != rts->rsumblocks) { -xchk_ino_set_corrupt (sc, rsumip->i_ino); +xchk_ip_set_corrupt (sc, rsumip);return 0 ; }/* The summary file length must be aligned to an fsblock. */ if (rsumip->i_disk_size & mp->m_blockmask) { -xchk_ino_set_corrupt (sc, rsumip->i_ino); +xchk_ip_set_corrupt (sc, rsumip);return 0 ; }
@@ -343,7 +343,7 @@ xchk_rtsummary(* the file can be larger than rsumsize. */ if (rsumip->i_disk_size <XFS_FSB_TO_B (mp, rts->rsumblocks)) { -xchk_ino_set_corrupt (sc, rsumip->i_ino); +xchk_ip_set_corrupt (sc, rsumip);return 0 ; }
@@ -359,7 +359,7 @@ xchk_rtsummary(* EFSCORRUPTED means the rtbitmap is corrupt, which is an xref * error since we're checking the summary file. */ -xchk_ino_set_corrupt (sc, rbmip->i_ino); +xchk_ino_xref_set_corrupt (sc, rbmip->i_ino);return 0 ; }if (error)
include/linux/futex.h +2 -0
@@ -77,6 +77,7 @@ static inline void futex_init_task(struct task_struct *tsk)void futex_exit_recursive (struct task_struct *tsk);void futex_exit_release (struct task_struct *tsk);void futex_exec_release (struct task_struct *tsk); +void futex_exec_done (struct task_struct *tsk);long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout,u32 __user *uaddr2,u32 val2,u32 val3);
@@ -98,6 +99,7 @@ static inline void futex_init_task(struct task_struct *tsk) { }static inline void futex_exit_recursive (struct task_struct *tsk) { }static inline void futex_exit_release (struct task_struct *tsk) { }static inline void futex_exec_release (struct task_struct *tsk) { } +static inline void futex_exec_done (struct task_struct *tsk) { }static inline long do_futex (u32 __user *uaddr,int op,u32 val,ktime_t *timeout,u32 __user *uaddr2,u32 val2,u32 val3)
include/linux/pci-ecam.h +3 -0
@@ -81,6 +81,9 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,/* default ECAM ops */ extern const struct pci_ecam_ops pci_generic_ecam_ops; +/* default CAM ops */ +extern const struct pci_ecam_ops pci_generic_cam_ops; +#if defined(CONFIG_ACPI ) && defined(CONFIG_PCI_QUIRKS )extern const struct pci_ecam_ops pci_32b_ops;/* 32-bit accesses only */ extern const struct pci_ecam_ops pci_32b_read_ops;/* 32-bit read only */
include/linux/sched.h +8 -0
@@ -1540,6 +1540,14 @@ struct task_struct {/* Collect coverage from softirq context: */ unsigned int kcov_softirq; + +/* Temporary storage for preempting remote coverage collection: */ +unsigned int kcov_saved_mode; +unsigned int kcov_saved_size; +void *kcov_saved_area; +struct kcov *kcov_saved_kcov; +int kcov_saved_sequence; +#endif #ifdef CONFIG_MEMCG_V1
include/linux/wait.h +1 -0
@@ -1213,6 +1213,7 @@ long prepare_to_wait_event(struct wait_queue_head *wq_head, struct wait_queue_envoid finish_wait (struct wait_queue_head *wq_head,struct wait_queue_entry *wq_entry);long wait_woken (struct wait_queue_entry *wq_entry,unsigned mode,long timeout);int woken_wake_function (struct wait_queue_entry *wq_entry,unsigned mode,int sync,void *key); +int woken_wake_bit_function (struct wait_queue_entry *wq_entry,unsigned mode,int sync,void *key);int autoremove_wake_function (struct wait_queue_entry *wq_entry,unsigned mode,int sync,void *key);#define DEFINE_WAIT_FUNC (name, function) \
include/linux/wait_bit.h +1 -0
@@ -32,6 +32,7 @@ int out_of_line_wait_on_bit_timeout(unsigned long *word, int, wait_bit_action_fint out_of_line_wait_on_bit_lock (unsigned long *word,int ,wait_bit_action_f *action,unsigned int mode);struct wait_queue_head *bit_waitqueue (unsigned long *word,int bit);extern void __init wait_bit_init (void ); +extern struct wait_bit_key *__var_wake_key (struct wait_queue_entry *wq_entry,void *arg);int wake_bit_function (struct wait_queue_entry *wq_entry,unsigned mode,int sync,void *key);
io_uring/futex.c +11 -0
@@ -144,6 +144,17 @@ int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) !futex_validate_input(iof->futex_flags, iof->futex_mask)) return -EINVAL; +return 0 ; +} + +int io_futex_wait_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) +{ +int ret; + + ret =io_futex_prep (req, sqe); +if (unlikely (ret)) +return ret; +/* Mark as inflight, so file exit cancelation will find it */ io_req_track_inflight (req);return 0 ;
io_uring/futex.h +1 -0
@@ -3,6 +3,7 @@#include "cancel.h" int io_futex_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe); +int io_futex_wait_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe);int io_futexv_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe);int io_futex_wait (struct io_kiocb *req,unsigned int issue_flags);int io_futexv_wait (struct io_kiocb *req,unsigned int issue_flags);
io_uring/io-wq.c +6 -3
@@ -210,9 +210,12 @@ static void io_worker_cancel_cb(struct io_worker *worker)struct io_wq *wq = worker->wq;atomic_dec (&acct->nr_running); -raw_spin_lock (&acct->workers_lock); - acct->nr_workers--; -raw_spin_unlock (&acct->workers_lock); +/* create_worker_cb() has not reserved a worker slot yet. */ +if (worker->create_work.func != create_worker_cb) { +raw_spin_lock (&acct->workers_lock); + acct->nr_workers--; +raw_spin_unlock (&acct->workers_lock); + }io_worker_ref_put (wq);clear_bit_unlock (0 , &worker->create_state);io_worker_release (worker);
io_uring/opdef.c +1 -1
@@ -466,7 +466,7 @@ const struct io_issue_def io_issue_defs[] = { }, [IORING_OP_FUTEX_WAIT] = {#if defined(CONFIG_FUTEX ) - .prep = io_futex_prep, + .prep = io_futex_wait_prep, .issue = io_futex_wait, #else .prep = io_eopnotsupp_prep,
io_uring/rsrc.c +1 -1
@@ -1349,7 +1349,7 @@ static int io_vec_fill_bvec(int ddir, struct iov_iter *iter, struct iovec *iovec, unsigned nr_iovs, struct iou_vec *vec) { - unsigned long folio_size = 1 << imu->folio_shift; + unsigned long folio_size = 1UL << imu->folio_shift;unsigned long folio_mask = folio_size -1 ;struct bio_vec *res_bvec = vec->bvec;size_t total_len =0 ;
io_uring/uring_cmd.c +4 -4
@@ -38,6 +38,8 @@ static void io_req_uring_cleanup(struct io_kiocb *req, unsigned int issue_flags)if (io_alloc_cache_put (&req->ctx->cmd_cache, ac)) { ioucmd->sqe =NULL ;io_req_async_data_clear (req,REQ_F_NEED_CLEANUP ); + }else { +io_vec_free (&ac->vec); } }
@@ -212,6 +214,8 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ac =io_uring_alloc_async_data (&req->ctx->cmd_cache, req);if (!ac)return -ENOMEM ; +if (ac->vec.iovec) + req->flags |=REQ_F_NEED_CLEANUP ; ioucmd->sqe = sqe;return 0 ; }
@@ -261,10 +265,6 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags) } ret = file->f_op->uring_cmd (ioucmd, issue_flags); -if (ioucmd->flags &IORING_URING_CMD_MULTISHOT ) { -if (ret >=0 ) -return IOU_ISSUE_SKIP_COMPLETE ; - }if (ret == -EAGAIN ) { ioucmd->flags |=IORING_URING_CMD_REISSUE ;return ret;
kernel/futex/core.c +78 -38
174 lines not on this page · raw message
kernel/futex/futex.h +9 -0
@@ -126,6 +126,15 @@ static inline bool should_fail_futex(bool fshared) }#endif +static inline bool futex_key_is_private (union futex_key *key) +{ +/* +* Relies on get_futex_key() to set either bit for shared +* futexes -- see comment with union futex_key. +*/ +return !(key->both.offset & (FUT_OFF_INODE |FUT_OFF_MMSHARED )); +} +/* * Hash buckets are shared by all the futex_keys that hash to the same * location. Each key may have multiple futex_q structures, one for each task
kernel/futex/pi.c +93 -28
158 lines not on this page · raw message
kernel/kcov.c +47 -43
169 lines not on this page · raw message
kernel/sched/wait.c +15 -0
@@ -5,6 +5,7 @@* (C) 2004 Nadia Yvette Chambers, Oracle */ #include "sched.h" +#include <linux/wait_bit.h> void __init_waitqueue_head (struct wait_queue_head *wq_head,const char *name,struct lock_class_key *key) {
@@ -463,3 +464,17 @@ int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int syreturn default_wake_function (wq_entry, mode, sync, key); }EXPORT_SYMBOL (woken_wake_function); + +int woken_wake_bit_function (struct wait_queue_entry *wq_entry,unsigned mode,int sync,void *arg) +{ +struct wait_bit_key *key =__var_wake_key (wq_entry, arg); +if (!key) +return 0 ; + +/* Pairs with the smp_store_mb() in wait_woken(). */ +smp_mb ();/* C */ + wq_entry->flags |=WQ_FLAG_WOKEN ; + +return default_wake_function (wq_entry, mode, sync, key); +} +EXPORT_SYMBOL (woken_wake_bit_function);
kernel/sched/wait_bit.c +11 -3
@@ -167,9 +167,7 @@ wait_queue_head_t *__var_waitqueue(void *p) }EXPORT_SYMBOL (__var_waitqueue); -static int -var_wake_function (struct wait_queue_entry *wq_entry,unsigned int mode, -int sync,void *arg) +struct wait_bit_key *__var_wake_key (struct wait_queue_entry *wq_entry,void *arg) {struct wait_bit_key *key = arg; struct wait_bit_queue_entry *wbq_entry =
@@ -177,6 +175,16 @@ var_wake_function(struct wait_queue_entry *wq_entry, unsigned int mode,if (wbq_entry->key.flags != key->flags || wbq_entry->key.bit_nr != key->bit_nr) +return NULL ; + +return key; +} + +static int var_wake_function (struct wait_queue_entry *wq_entry,unsigned int mode, +int sync,void *arg) +{ +struct wait_bit_key *key =__var_wake_key (wq_entry, arg); +if (!key)return 0 ;return autoremove_wake_function (wq_entry, mode, sync, key);
lib/Kconfig.debug +3 -2
@@ -2157,10 +2157,11 @@ config KCOV_INSTRUMENT_ALL config KCOV_IRQ_AREA_SIZE hex "Size of interrupt coverage collection area in words" depends on KCOV + range 0x80 0x1000000 default 0x40000 help - KCOV uses preallocated per-cpu areas to collect coverage from - soft interrupts. This specifies the size of those areas in the + KCOV uses preallocated areas to collect coverage from soft + interrupts. This specifies the size of those areas in the number of unsigned long words. config KCOV_SELFTEST
net/bluetooth/hci_event.c +6 -2
@@ -293,8 +293,10 @@ static u8 hci_cc_reset(struct hci_dev *hdev, void *data, struct sk_buff *skb) hdev->ssp_debug_mode =0 ; +hci_dev_lock (hdev);hci_bdaddr_list_clear (&hdev->le_accept_list);hci_bdaddr_list_clear (&hdev->le_resolv_list); +hci_dev_unlock (hdev);return rp->status; }
@@ -3815,8 +3817,10 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"status 0x%2.2x" , rp->status); cp =hci_sent_cmd_data (hdev,HCI_OP_LE_SET_CIG_PARAMS ); -if (!rp->status && (!cp || rp->num_handles != cp->num_cis || - rp->cig_id != cp->cig_id)) { +if (!rp->status && + (!cp || rp->num_handles != cp->num_cis || + rp->cig_id != cp->cig_id || + skb->len <array_size (rp->num_handles,sizeof (*rp->handle)))) {bt_dev_err (hdev,"unexpected Set CIG Parameters response data" ); status =HCI_ERROR_UNSPECIFIED ; }
net/bluetooth/hci_sync.c +37 -9
66 lines not on this page · raw message
net/bluetooth/iso.c +24 -8
@@ -1415,6 +1415,7 @@ static int iso_sock_getname(struct socket *sock, struct sockaddr *addr,lock_sock (sk); +memset (sa,0 ,sizeof (struct sockaddr_iso )); addr->sa_family =AF_BLUETOOTH ;if (peer) {
@@ -1425,6 +1426,7 @@ static int iso_sock_getname(struct socket *sock, struct sockaddr *addr, sa->iso_bdaddr_type =iso_pi (sk)->dst_type;if (hcon && (hcon->type ==BIS_LINK || hcon->type ==PA_LINK )) { +memset (sa->iso_bc,0 ,sizeof (struct sockaddr_iso_bc )); sa->iso_bc->bc_sid =iso_pi (sk)->bc_sid; sa->iso_bc->bc_num_bis =iso_pi (sk)->bc_num_bis; memcpy(sa->iso_bc->bc_bis, iso_pi(sk)->bc_bis,
@@ -1537,9 +1539,9 @@ static void iso_conn_defer_accept(struct hci_conn *conn)hci_send_cmd (hdev,HCI_OP_LE_ACCEPT_CIS ,sizeof (cp), &cp); } -static void iso_conn_big_sync (struct sock *sk) +static int iso_conn_big_sync (struct sock *sk) { -int err; +int err =0 ;struct hci_dev *hdev;struct iso_conn *conn;bdaddr_t src, dst;
@@ -1554,7 +1556,7 @@ static void iso_conn_big_sync(struct sock *sk) hdev =hci_get_route (&dst, &src, src_type);if (!hdev) -return ; +return -EHOSTUNREACH ;/* hci_le_big_create_sync requires hdev lock to be held, since * it enqueues the HCI LE BIG Create Sync command via
@@ -1570,8 +1572,10 @@ static void iso_conn_big_sync(struct sock *sk)* both before dereferencing conn->hcon. */ conn =iso_pi (sk)->conn; -if (!conn || !conn->hcon) +if (!conn || !conn->hcon) { + err = -ENOTCONN ; goto unlock; + }if (!test_and_set_bit (BT_SK_BIG_SYNC , &iso_pi (sk)->flags)) { err = hci_conn_big_create_sync(hdev, conn->hcon,
@@ -1587,6 +1591,8 @@ static void iso_conn_big_sync(struct sock *sk)release_sock (sk);hci_dev_unlock (hdev);hci_dev_put (hdev); + +return err; } static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,
@@ -1611,10 +1617,19 @@ static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,case BT_CONNECT2 :if (test_bit (BT_SK_PA_SYNC , &pi->flags)) {release_sock (sk); -iso_conn_big_sync (sk); + err =iso_conn_big_sync (sk);lock_sock (sk); - sk->sk_state =BT_LISTEN ; +/* The socket lock was dropped, so the +* connection may have been torn down +* meanwhile and iso_chan_del() may have +* already moved the socket to BT_CLOSED. +* Only move on to BT_LISTEN if the BIG sync +* was actually started and nothing else has +* changed the state. +*/ +if (!err && sk->sk_state ==BT_CONNECT2 ) + sk->sk_state =BT_LISTEN ; }else {iso_conn_defer_accept (pi->conn->hcon); sk->sk_state =BT_CONFIG ;
@@ -1625,10 +1640,11 @@ static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,case BT_CONNECTED :if (test_bit (BT_SK_PA_SYNC , &iso_pi (sk)->flags)) {release_sock (sk); -iso_conn_big_sync (sk); + err =iso_conn_big_sync (sk);lock_sock (sk); - sk->sk_state =BT_LISTEN ; +if (!err && sk->sk_state ==BT_CONNECTED ) + sk->sk_state =BT_LISTEN ; early_ret = true; }
net/bluetooth/mgmt.c +8 -0
@@ -2671,6 +2671,14 @@ static int mgmt_hci_cmd_sync(struct sock *sk, struct hci_dev *hdev,return mgmt_cmd_status (sk, hdev->id,MGMT_OP_HCI_CMD_SYNC ,MGMT_STATUS_INVALID_PARAMS ); +/* The HCI command header carries the parameter length in a u8, a +* larger value would be truncated there while the parameters are +* still appended to the frame in full. +*/ +if (le16_to_cpu (cp->params_len) >U8_MAX ) +return mgmt_cmd_status (sk, hdev->id,MGMT_OP_HCI_CMD_SYNC , +MGMT_STATUS_INVALID_PARAMS ); +hci_dev_lock (hdev); cmd =mgmt_pending_new (sk,MGMT_OP_HCI_CMD_SYNC , hdev, data, len);if (!cmd)
net/bluetooth/rfcomm/core.c +21 -3
@@ -1334,7 +1334,10 @@ static struct rfcomm_session *rfcomm_recv_disc(struct rfcomm_session *s,return s; } -void rfcomm_dlc_accept (struct rfcomm_dlc *d) +/* Must be called with rfcomm_mutex held, so that the session cannot be +* unlinked from under us. +*/ +static void __rfcomm_dlc_accept (struct rfcomm_dlc *d) {struct sock *sk = d->session->sock->sk;struct l2cap_conn *conn =l2cap_pi (sk)->chan->conn;
@@ -1356,6 +1359,21 @@ void rfcomm_dlc_accept(struct rfcomm_dlc *d)rfcomm_send_msc (d->session,1 , d->dlci, d->v24_sig); } +void rfcomm_dlc_accept (struct rfcomm_dlc *d) +{ +rfcomm_lock (); + +/* rfcomm_recv_disc() sets the dlc state to BT_CLOSED before calling +* __rfcomm_dlc_close(), so the RFCOMM_DEFER_SETUP handshake there is +* skipped and the session can already be unlinked by the time the +* deferred accept runs from rfcomm_sock_recvmsg(). +*/ +if (d->session) +__rfcomm_dlc_accept (d); + +rfcomm_unlock (); +} +static void rfcomm_check_accept (struct rfcomm_dlc *d) {if (rfcomm_check_security (d)) {
@@ -1368,7 +1386,7 @@ static void rfcomm_check_accept(struct rfcomm_dlc *d) d->state_change (d,0 );rfcomm_dlc_unlock (d); }else -rfcomm_dlc_accept (d); +__rfcomm_dlc_accept (d); }else {set_bit (RFCOMM_AUTH_PENDING , &d->flags);rfcomm_dlc_set_timer (d,RFCOMM_AUTH_TIMEOUT );
@@ -1953,7 +1971,7 @@ static void rfcomm_process_dlcs(struct rfcomm_session *s) d->state_change (d,0 );rfcomm_dlc_unlock (d); }else -rfcomm_dlc_accept (d); +__rfcomm_dlc_accept (d); }continue ; }else if (test_and_clear_bit (RFCOMM_AUTH_REJECT , &d->flags)) {
net/ceph/osd_client.c +4 -1
@@ -5033,7 +5033,7 @@ static int decode_watchers(void **p, void *end,if (ret)return ret; - *num_watchers =ceph_decode_32 (p); +ceph_decode_32_safe (p, end, *num_watchers, bad); *watchers =kcalloc (*num_watchers,sizeof (**watchers),GFP_NOIO );if (!*watchers)return -ENOMEM ;
@@ -5047,6 +5047,9 @@ static int decode_watchers(void **p, void *end, }return 0 ; + +bad: +return -EINVAL ; }/*
net/core/gro.c +5 -2
@@ -118,9 +118,12 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)if (unlikely (p->len + len >=GRO_LEGACY_MAX_SIZE )) {if (NAPI_GRO_CB (skb)->proto !=IPPROTO_TCP || +NAPI_GRO_CB (skb)->encap_mark || + p->encapsulation || (p->protocol ==htons (ETH_P_IPV6 ) && -skb_headroom (p) <sizeof (struct hop_jumbo_hdr )) || - p->encapsulation) + p->mac_header <sizeof (struct hop_jumbo_hdr )) || + (p->protocol !=htons (ETH_P_IPV6 ) && + p->protocol !=htons (ETH_P_IP )))return -E2BIG ; }
net/ipv4/ip_output.c +4 -0
@@ -791,6 +791,10 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,*/ hlen = iph->ihl *4 ; +if (mtu < hlen +8 ) { + err = -EMSGSIZE ; + goto fail; + } mtu = mtu - hlen;/* Size of data space */ IPCB (skb)->flags |=IPSKB_FRAG_COMPLETE ; ll_rs =LL_RESERVED_SPACE (rt->dst.dev);
net/ipv6/ip6_output.c +2 -0
@@ -116,6 +116,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *if (res !=LWTUNNEL_XMIT_CONTINUE )return res; + hdr =ipv6_hdr (skb); + daddr = &hdr->daddr; }IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUT , skb->len);
net/mptcp/options.c +1 -1
@@ -1259,7 +1259,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_ADDADDR ); }else {mptcp_pm_add_addr_echoed (msk, &mp_opt.addr); -mptcp_pm_del_add_timer (msk, &mp_opt.addr, true); +mptcp_pm_announced_del_timer (msk, &mp_opt.addr, true);MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_ECHOADD ); }
net/mptcp/pm.c +41 -33
181 lines not on this page · raw message
sound/usb/mixer_scarlett2.c +63 -35
98 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.