Compare
c01b091b06412d3b1b53d8c2925f6de586c8a2fc..70db8dea2aac43dd4f9a7ec2365d8c950efaa07d
Merge tag 'drm-intel-fixes-2026-10-15' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-fixes
- Fix ARL-S host bridge detection - Add sanity checks for malformed DMC firmware Signed-off-by: Dave Airlie <airlied@redhat.com> From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patch.msgid.link/atBtrhSxjkB7bVwm@jlahtine-mobl
Dave Airlie <airlied@redhat.com> · 2026-10-16 00:51 UTC
26 files changed,
+125
−110
- drivers/gpu/drm/i915/display/intel_cx0_phy.c
- drivers/gpu/drm/i915/display/intel_dmc.c
- drivers/gpu/drm/i915/display/intel_dmc_regs.h
- fs/9p/v9fs.h
- fs/9p/vfs_super.c
- fs/afs/internal.h
- fs/afs/super.c
- fs/ext4/ext4.h
- fs/ext4/extents-test.c
- fs/ext4/extents.c
- fs/ext4/extents_status.c
- fs/ext4/extents_status.h
- fs/ext4/super.c
- fs/ntfs3/ntfs_fs.h
- fs/ntfs3/super.c
- fs/ocfs2/dlm/dlmcommon.h
- fs/ocfs2/dlm/dlmdebug.c
- fs/ocfs2/dlm/dlmrecovery.c
- fs/pipe.c
- fs/tracefs/event_inode.c
- fs/unicode/utf8-core.c
- include/linux/sched/signal.h
- include/linux/unicode.h
- ipc/namespace.c
- kernel/watch_queue.c
- samples/pidfd/Makefile
modified drivers/gpu/drm/i915/display/intel_cx0_phy.c
| @@ -2342,12 +2342,14 @@ static void intel_c10pll_dump_hw_state(struct drm_printer *p, | |||
| 2342 | 2342 | static bool is_arrowlake_s_by_host_bridge(void) | |
| 2343 | 2343 | { | |
| 2344 | 2344 | struct pci_dev *pdev = NULL; | |
| 2345 | - | u16 host_bridge_pci_dev_id; | |
| 2346 | - | ||
| 2347 | - | while ((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST << 8, pdev))) | |
| 2348 | - | host_bridge_pci_dev_id = pdev->device; | |
| 2345 | + | while ((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST << 8, pdev))) { | |
| 2346 | + | if (IS_ARROWLAKE_S_BY_HOST_BRIDGE_ID(pdev->device)) { | |
| 2347 | + | pci_dev_put(pdev); | |
| 2348 | + | return true; | |
| 2349 | + | } | |
| 2350 | + | } | |
| 2349 | 2351 | ||
| 2350 | - | return pdev && IS_ARROWLAKE_S_BY_HOST_BRIDGE_ID(host_bridge_pci_dev_id); | |
| 2352 | + | return false; | |
| 2351 | 2353 | } | |
| 2352 | 2354 | ||
| 2353 | 2355 | static u16 intel_c20_hdmi_tmds_tx_cgf_1(struct intel_display *display) | |
modified drivers/gpu/drm/i915/display/intel_dmc.c
| @@ -1023,6 +1023,55 @@ static void dmc_set_fw_offset(struct intel_dmc *dmc, | |||
| 1023 | 1023 | } | |
| 1024 | 1024 | } | |
| 1025 | 1025 | ||
| 1026 | + | /* | |
| 1027 | + | * Check if the load address is within the valid range for the given DMC ID. | |
| 1028 | + | */ | |
| 1029 | + | static bool dmc_load_addr_sanity_check(struct intel_dmc *dmc, | |
| 1030 | + | u32 start_addr, u32 payload_size, | |
| 1031 | + | int header_ver, enum intel_dmc_id dmc_id) | |
| 1032 | + | { | |
| 1033 | + | u32 start_range, end_range, end_addr; | |
| 1034 | + | ||
| 1035 | + | if (header_ver != 3) | |
| 1036 | + | return true; | |
| 1037 | + | ||
| 1038 | + | switch (dmc_id) { | |
| 1039 | + | case DMC_FW_MAIN: | |
| 1040 | + | start_range = DMC_MAIN_PROGRAM_BASE_START; | |
| 1041 | + | end_range = DMC_MAIN_PROGRAM_BASE_END; | |
| 1042 | + | break; | |
| 1043 | + | case DMC_FW_PIPEA: | |
| 1044 | + | start_range = DMC_PIPEA_PROGRAM_BASE_START; | |
| 1045 | + | end_range = DMC_PIPEA_PROGRAM_BASE_END; | |
| 1046 | + | break; | |
| 1047 | + | case DMC_FW_PIPEB: | |
| 1048 | + | start_range = DMC_PIPEB_PROGRAM_BASE_START; | |
| 1049 | + | end_range = DMC_PIPEB_PROGRAM_BASE_END; | |
| 1050 | + | break; | |
| 1051 | + | case DMC_FW_PIPEC: | |
| 1052 | + | start_range = DMC_PIPEC_PROGRAM_BASE_START; | |
| 1053 | + | end_range = DMC_PIPEC_PROGRAM_BASE_END; | |
| 1054 | + | break; | |
| 1055 | + | case DMC_FW_PIPED: | |
| 1056 | + | start_range = DMC_PIPED_PROGRAM_BASE_START; | |
| 1057 | + | end_range = DMC_PIPED_PROGRAM_BASE_END; | |
| 1058 | + | break; | |
| 1059 | + | default: | |
| 1060 | + | MISSING_CASE(dmc_id); | |
| 1061 | + | return false; | |
| 1062 | + | } | |
| 1063 | + | ||
| 1064 | + | if (payload_size == 0) | |
| 1065 | + | end_addr = start_addr; | |
| 1066 | + | else if (check_add_overflow(start_addr, payload_size - 1, &end_addr)) | |
| 1067 | + | return false; | |
| 1068 | + | ||
| 1069 | + | if (start_addr < start_range || end_addr > end_range) | |
| 1070 | + | return false; | |
| 1071 | + | ||
| 1072 | + | return true; | |
| 1073 | + | } | |
| 1074 | + | ||
| 1026 | 1075 | static bool dmc_mmio_addr_sanity_check(struct intel_dmc *dmc, | |
| 1027 | 1076 | const u32 *mmioaddr, u32 mmio_count, | |
| 1028 | 1077 | int header_ver, enum intel_dmc_id dmc_id) | |
| @@ -1120,7 +1169,7 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc, | |||
| 1120 | 1169 | } | |
| 1121 | 1170 | ||
| 1122 | 1171 | /* Cache the dmc header info. */ | |
| 1123 | - | if (mmio_count > mmio_count_max) { | |
| 1172 | + | if (!mmio_count || mmio_count > mmio_count_max) { | |
| 1124 | 1173 | drm_err(display->drm, "DMC firmware has wrong mmio count %u\n", mmio_count); | |
| 1125 | 1174 | return 0; | |
| 1126 | 1175 | } | |
| @@ -1166,13 +1215,21 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc, | |||
| 1166 | 1215 | disable_dmc_evt(display, dmc_id, dmc_info->mmioaddr[i], | |
| 1167 | 1216 | dmc_info->mmiodata[i]) ? " (disabling)" : ""); | |
| 1168 | 1217 | } | |
| 1169 | - | dmc_info->mmio_count = mmio_count; | |
| 1170 | - | dmc_info->start_mmioaddr = start_mmioaddr; | |
| 1171 | 1218 | ||
| 1172 | 1219 | rem_size -= header_len_bytes; | |
| 1173 | 1220 | ||
| 1174 | 1221 | /* fw_size is in dwords, so multiplied by 4 to convert into bytes. */ | |
| 1175 | - | payload_size = dmc_header->fw_size * 4; | |
| 1222 | + | if (check_mul_overflow(dmc_header->fw_size, 4u, &payload_size)) { | |
| 1223 | + | drm_err(display->drm, "DMC fw_size too large (%u dwords)\n", | |
| 1224 | + | dmc_header->fw_size); | |
| 1225 | + | return 0; | |
| 1226 | + | } | |
| 1227 | + | ||
| 1228 | + | if (!payload_size) { | |
| 1229 | + | drm_err(display->drm, "DMC firmware has empty payload\n"); | |
| 1230 | + | return 0; | |
| 1231 | + | } | |
| 1232 | + | ||
| 1176 | 1233 | if (rem_size < payload_size) | |
| 1177 | 1234 | goto error_truncated; | |
| 1178 | 1235 | ||
| @@ -1180,12 +1237,21 @@ static u32 parse_dmc_fw_header(struct intel_dmc *dmc, | |||
| 1180 | 1237 | drm_err(display->drm, "DMC FW too big (%u bytes)\n", payload_size); | |
| 1181 | 1238 | return 0; | |
| 1182 | 1239 | } | |
| 1183 | - | dmc_info->dmc_fw_size = dmc_header->fw_size; | |
| 1240 | + | ||
| 1241 | + | if (!dmc_load_addr_sanity_check(dmc, start_mmioaddr, payload_size, | |
| 1242 | + | dmc_header->header_ver, dmc_id)) { | |
| 1243 | + | drm_err(display->drm, "DMC %d: firmware has wrong load address\n", dmc_id); | |
| 1244 | + | return 0; | |
| 1245 | + | } | |
| 1184 | 1246 | ||
| 1185 | 1247 | dmc_info->payload = kmalloc(payload_size, GFP_KERNEL); | |
| 1186 | 1248 | if (!dmc_info->payload) | |
| 1187 | 1249 | return 0; | |
| 1188 | 1250 | ||
| 1251 | + | dmc_info->mmio_count = mmio_count; | |
| 1252 | + | dmc_info->start_mmioaddr = start_mmioaddr; | |
| 1253 | + | dmc_info->dmc_fw_size = dmc_header->fw_size; | |
| 1254 | + | ||
| 1189 | 1255 | payload = (u8 *)(dmc_header) + header_len_bytes; | |
| 1190 | 1256 | memcpy(dmc_info->payload, payload, payload_size); | |
| 1191 | 1257 | ||
modified drivers/gpu/drm/i915/display/intel_dmc_regs.h
| @@ -521,6 +521,18 @@ enum pipedmc_event_id { | |||
| 521 | 521 | #define TGL_PIPE_MMIO_END(dmc_id) _PICK_EVEN(((dmc_id) - 1), _TGL_PIPEA_MMIO_END,\ | |
| 522 | 522 | _TGL_PIPEB_MMIO_END) | |
| 523 | 523 | ||
| 524 | + | /* For DMC header version v3*/ | |
| 525 | + | #define DMC_MAIN_PROGRAM_BASE_START 0x80000 | |
| 526 | + | #define DMC_MAIN_PROGRAM_BASE_END 0x86fff | |
| 527 | + | #define DMC_PIPEA_PROGRAM_BASE_START 0x90000 | |
| 528 | + | #define DMC_PIPEA_PROGRAM_BASE_END 0x96fff | |
| 529 | + | #define DMC_PIPEB_PROGRAM_BASE_START 0x98000 | |
| 530 | + | #define DMC_PIPEB_PROGRAM_BASE_END 0x9efff | |
| 531 | + | #define DMC_PIPEC_PROGRAM_BASE_START 0x52000 | |
| 532 | + | #define DMC_PIPEC_PROGRAM_BASE_END 0x53fff | |
| 533 | + | #define DMC_PIPED_PROGRAM_BASE_START 0x59000 | |
| 534 | + | #define DMC_PIPED_PROGRAM_BASE_END 0x5afff | |
| 535 | + | ||
| 524 | 536 | #define SKL_DMC_DC3_DC5_COUNT _MMIO(0x80030) | |
| 525 | 537 | #define SKL_DMC_DC5_DC6_COUNT _MMIO(0x8002C) | |
| 526 | 538 | #define BXT_DMC_DC3_DC5_COUNT _MMIO(0x80038) | |
modified fs/9p/v9fs.h
| @@ -137,7 +137,6 @@ struct v9fs_session_info { | |||
| 137 | 137 | struct list_head slist; /* list of sessions registered with v9fs */ | |
| 138 | 138 | struct rw_semaphore rename_sem; | |
| 139 | 139 | long session_lock_timeout; /* retry interval for blocking locks */ | |
| 140 | - | struct rcu_head rcu; /* v9fs_vfs_get_link_dotl() reads ->cache in rcu pathwalk */ | |
| 141 | 140 | }; | |
| 142 | 141 | ||
| 143 | 142 | #define NDENTRY_TIMEOUT_NEVER (-1U) | |
modified fs/9p/vfs_super.c
| @@ -173,8 +173,8 @@ static void v9fs_kill_super(struct super_block *s) | |||
| 173 | 173 | ||
| 174 | 174 | v9fs_session_cancel(v9ses); | |
| 175 | 175 | v9fs_session_close(v9ses); | |
| 176 | - | /* v9fs_vfs_get_link_dotl() may still read ->cache in rcu pathwalk */ | |
| 177 | - | kfree_rcu(v9ses, rcu); | |
| 176 | + | kfree(v9ses); | |
| 177 | + | s->s_fs_info = NULL; | |
| 178 | 178 | p9_debug(P9_DEBUG_VFS, "exiting kill_super\n"); | |
| 179 | 179 | } | |
| 180 | 180 | ||
modified fs/afs/internal.h
| @@ -251,8 +251,6 @@ struct afs_super_info { | |||
| 251 | 251 | struct afs_volume *volume; /* volume record */ | |
| 252 | 252 | enum afs_flock_mode flock_mode:8; /* File locking emulation mode */ | |
| 253 | 253 | bool dyn_root; /* True if dynamic root */ | |
| 254 | - | /* afs_atcell_get_link() reads ->net_ns in rcu pathwalk */ | |
| 255 | - | struct rcu_head rcu; | |
| 256 | 254 | }; | |
| 257 | 255 | ||
| 258 | 256 | static inline struct afs_super_info *AFS_FS_S(struct super_block *sb) | |
modified fs/afs/super.c
| @@ -523,7 +523,7 @@ static void afs_destroy_sbi(struct afs_super_info *as) | |||
| 523 | 523 | afs_put_volume(as->volume, afs_volume_trace_put_destroy_sbi); | |
| 524 | 524 | afs_unuse_cell(as->cell, afs_cell_trace_unuse_sbi); | |
| 525 | 525 | put_net(as->net_ns); | |
| 526 | - | kfree_rcu(as, rcu); | |
| 526 | + | kfree(as); | |
| 527 | 527 | } | |
| 528 | 528 | } | |
| 529 | 529 | ||
modified fs/ext4/ext4.h
| @@ -1774,8 +1774,6 @@ struct ext4_sb_info { | |||
| 1774 | 1774 | struct list_head s_es_list; /* List of inodes with reclaimable extents */ | |
| 1775 | 1775 | long s_es_nr_inode; | |
| 1776 | 1776 | struct ext4_es_stats s_es_stats; | |
| 1777 | - | /* ext4_get_link() reads the sbi in rcu pathwalk */ | |
| 1778 | - | struct rcu_head s_rcu; | |
| 1779 | 1777 | struct mb_cache *s_ea_block_cache; | |
| 1780 | 1778 | struct mb_cache *s_ea_inode_cache; | |
| 1781 | 1779 | ||
modified fs/ext4/extents-test.c
| @@ -151,7 +151,6 @@ static void extents_kunit_exit(struct kunit *test) | |||
| 151 | 151 | ||
| 152 | 152 | sbi = k_ctx.k_ei->vfs_inode.i_sb->s_fs_info; | |
| 153 | 153 | ext4_es_unregister_shrinker(sbi); | |
| 154 | - | ext4_es_destroy_stats(sbi); | |
| 155 | 154 | deactivate_super(sbi->s_sb); | |
| 156 | 155 | kfree(sbi); | |
| 157 | 156 | kfree(k_ctx.k_ei); | |
| @@ -341,7 +340,6 @@ out: | |||
| 341 | 340 | k_ctx.k_data = NULL; | |
| 342 | 341 | ||
| 343 | 342 | ext4_es_unregister_shrinker(sbi); | |
| 344 | - | ext4_es_destroy_stats(sbi); | |
| 345 | 343 | out_deactivate: | |
| 346 | 344 | deactivate_locked_super(sb); | |
| 347 | 345 | kfree(sbi); | |
modified fs/ext4/extents.c
| @@ -6409,7 +6409,6 @@ EXPORT_SYMBOL_FOR_EXT4_TEST(__ext4_ext_dirty); | |||
| 6409 | 6409 | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_ext_zeroout); | |
| 6410 | 6410 | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_es_register_shrinker); | |
| 6411 | 6411 | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_es_unregister_shrinker); | |
| 6412 | - | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_es_destroy_stats); | |
| 6413 | 6412 | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_map_create_blocks); | |
| 6414 | 6413 | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_es_init_tree); | |
| 6415 | 6414 | EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_es_lookup_extent); | |
modified fs/ext4/extents_status.c
| @@ -1881,17 +1881,12 @@ err1: | |||
| 1881 | 1881 | } | |
| 1882 | 1882 | ||
| 1883 | 1883 | void ext4_es_unregister_shrinker(struct ext4_sb_info *sbi) | |
| 1884 | - | { | |
| 1885 | - | shrinker_free(sbi->s_es_shrinker); | |
| 1886 | - | } | |
| 1887 | - | ||
| 1888 | - | /* ext4_get_link() bumps the hit and miss counters in rcu pathwalk */ | |
| 1889 | - | void ext4_es_destroy_stats(struct ext4_sb_info *sbi) | |
| 1890 | 1884 | { | |
| 1891 | 1885 | percpu_counter_destroy(&sbi->s_es_stats.es_stats_cache_hits); | |
| 1892 | 1886 | percpu_counter_destroy(&sbi->s_es_stats.es_stats_cache_misses); | |
| 1893 | 1887 | percpu_counter_destroy(&sbi->s_es_stats.es_stats_all_cnt); | |
| 1894 | 1888 | percpu_counter_destroy(&sbi->s_es_stats.es_stats_shk_cnt); | |
| 1889 | + | shrinker_free(sbi->s_es_shrinker); | |
| 1895 | 1890 | } | |
| 1896 | 1891 | ||
| 1897 | 1892 | /* | |
modified fs/ext4/extents_status.h
| @@ -238,7 +238,6 @@ static inline void ext4_es_store_pblock_status(struct extent_status *es, | |||
| 238 | 238 | ||
| 239 | 239 | extern int ext4_es_register_shrinker(struct ext4_sb_info *sbi); | |
| 240 | 240 | extern void ext4_es_unregister_shrinker(struct ext4_sb_info *sbi); | |
| 241 | - | extern void ext4_es_destroy_stats(struct ext4_sb_info *sbi); | |
| 242 | 241 | ||
| 243 | 242 | extern int ext4_seq_es_shrinker_info_show(struct seq_file *seq, void *v); | |
| 244 | 243 | ||
modified fs/ext4/super.c
| @@ -1279,14 +1279,6 @@ static void ext4_flex_groups_free(struct ext4_sb_info *sbi) | |||
| 1279 | 1279 | } | |
| 1280 | 1280 | } | |
| 1281 | 1281 | ||
| 1282 | - | static void ext4_put_sbi_rcu(struct rcu_head *head) | |
| 1283 | - | { | |
| 1284 | - | struct ext4_sb_info *sbi = container_of(head, struct ext4_sb_info, s_rcu); | |
| 1285 | - | ||
| 1286 | - | ext4_es_destroy_stats(sbi); | |
| 1287 | - | kfree(sbi); | |
| 1288 | - | } | |
| 1289 | - | ||
| 1290 | 1282 | static void ext4_put_super(struct super_block *sb) | |
| 1291 | 1283 | { | |
| 1292 | 1284 | struct ext4_sb_info *sbi = EXT4_SB(sb); | |
| @@ -1382,6 +1374,7 @@ static void ext4_put_super(struct super_block *sb) | |||
| 1382 | 1374 | ext4_stop_mmpd(sbi); | |
| 1383 | 1375 | ||
| 1384 | 1376 | brelse(sbi->s_sbh); | |
| 1377 | + | sb->s_fs_info = NULL; | |
| 1385 | 1378 | /* | |
| 1386 | 1379 | * Now that we are completely done shutting down the | |
| 1387 | 1380 | * superblock, we need to actually destroy the kobject. | |
| @@ -1394,8 +1387,7 @@ static void ext4_put_super(struct super_block *sb) | |||
| 1394 | 1387 | #if IS_ENABLED(CONFIG_UNICODE) | |
| 1395 | 1388 | utf8_unload(sb->s_encoding); | |
| 1396 | 1389 | #endif | |
| 1397 | - | /* ext4_get_link() reads the sbi and the counters in rcu pathwalk */ | |
| 1398 | - | call_rcu(&sbi->s_rcu, ext4_put_sbi_rcu); | |
| 1390 | + | kfree(sbi); | |
| 1399 | 1391 | } | |
| 1400 | 1392 | ||
| 1401 | 1393 | static struct kmem_cache *ext4_inode_cachep; | |
| @@ -5814,7 +5806,6 @@ failed_mount3a: | |||
| 5814 | 5806 | /* Drain deferred EA inode iputs from journal replay */ | |
| 5815 | 5807 | flush_delayed_work(&sbi->s_ea_inode_work); | |
| 5816 | 5808 | ext4_es_unregister_shrinker(sbi); | |
| 5817 | - | ext4_es_destroy_stats(sbi); | |
| 5818 | 5809 | failed_mount3: | |
| 5819 | 5810 | /* flush s_sb_upd_work before sbi destroy */ | |
| 5820 | 5811 | flush_work(&sbi->s_sb_upd_work); | |
modified fs/ntfs3/ntfs_fs.h
| @@ -211,7 +211,6 @@ struct ntfs_index { | |||
| 211 | 211 | /* Ntfs file system in-core superblock data. */ | |
| 212 | 212 | struct ntfs_sb_info { | |
| 213 | 213 | struct super_block *sb; | |
| 214 | - | struct rcu_head rcu; | |
| 215 | 214 | ||
| 216 | 215 | u32 discard_granularity; | |
| 217 | 216 | u64 discard_granularity_mask_inv; // ~(discard_granularity_mask_inv-1) | |
modified fs/ntfs3/super.c
| @@ -196,7 +196,7 @@ void *ntfs_set_shared(void *ptr, u32 bytes) | |||
| 196 | 196 | void *ret = NULL; | |
| 197 | 197 | int i, j = -1; | |
| 198 | 198 | ||
| 199 | - | spin_lock_bh(&s_shared_lock); | |
| 199 | + | spin_lock(&s_shared_lock); | |
| 200 | 200 | for (i = 0; i < ARRAY_SIZE(s_shared); i++) { | |
| 201 | 201 | if (!s_shared[i].cnt) { | |
| 202 | 202 | j = i; | |
| @@ -214,7 +214,7 @@ void *ntfs_set_shared(void *ptr, u32 bytes) | |||
| 214 | 214 | s_shared[j].cnt = 1; | |
| 215 | 215 | ret = ptr; | |
| 216 | 216 | } | |
| 217 | - | spin_unlock_bh(&s_shared_lock); | |
| 217 | + | spin_unlock(&s_shared_lock); | |
| 218 | 218 | ||
| 219 | 219 | return ret; | |
| 220 | 220 | } | |
| @@ -231,7 +231,7 @@ void *ntfs_put_shared(void *ptr) | |||
| 231 | 231 | void *ret = ptr; | |
| 232 | 232 | int i; | |
| 233 | 233 | ||
| 234 | - | spin_lock_bh(&s_shared_lock); | |
| 234 | + | spin_lock(&s_shared_lock); | |
| 235 | 235 | for (i = 0; i < ARRAY_SIZE(s_shared); i++) { | |
| 236 | 236 | if (s_shared[i].cnt && s_shared[i].ptr == ptr) { | |
| 237 | 237 | if (--s_shared[i].cnt) | |
| @@ -239,7 +239,7 @@ void *ntfs_put_shared(void *ptr) | |||
| 239 | 239 | break; | |
| 240 | 240 | } | |
| 241 | 241 | } | |
| 242 | - | spin_unlock_bh(&s_shared_lock); | |
| 242 | + | spin_unlock(&s_shared_lock); | |
| 243 | 243 | ||
| 244 | 244 | return ret; | |
| 245 | 245 | } | |
| @@ -708,8 +708,6 @@ static noinline void ntfs3_put_sbi(struct ntfs_sb_info *sbi) | |||
| 708 | 708 | ||
| 709 | 709 | static void ntfs3_free_sbi(struct ntfs_sb_info *sbi) | |
| 710 | 710 | { | |
| 711 | - | if (sbi->options) | |
| 712 | - | put_mount_options(sbi->options); | |
| 713 | 711 | kfree(sbi->new_rec); | |
| 714 | 712 | kvfree(ntfs_put_shared(sbi->upcase)); | |
| 715 | 713 | kvfree(sbi->def_table); | |
| @@ -721,11 +719,6 @@ static void ntfs3_free_sbi(struct ntfs_sb_info *sbi) | |||
| 721 | 719 | kfree(sbi); | |
| 722 | 720 | } | |
| 723 | 721 | ||
| 724 | - | static void ntfs3_free_sbi_rcu(struct rcu_head *head) | |
| 725 | - | { | |
| 726 | - | ntfs3_free_sbi(container_of(head, struct ntfs_sb_info, rcu)); | |
| 727 | - | } | |
| 728 | - | ||
| 729 | 722 | static void ntfs_put_super(struct super_block *sb) | |
| 730 | 723 | { | |
| 731 | 724 | struct ntfs_sb_info *sbi = sb->s_fs_info; | |
| @@ -735,11 +728,11 @@ static void ntfs_put_super(struct super_block *sb) | |||
| 735 | 728 | /* Mark rw ntfs as clear, if possible. */ | |
| 736 | 729 | ntfs_set_state(sbi, NTFS_DIRTY_CLEAR); | |
| 737 | 730 | ||
| 738 | - | /* | |
| 739 | - | * The mount options stay until the sbi is freed: ->d_hash() and | |
| 740 | - | * ->d_compare() of a pathwalk in rcu mode read the nls table through | |
| 741 | - | * them. | |
| 742 | - | */ | |
| 731 | + | if (sbi->options) { | |
| 732 | + | put_mount_options(sbi->options); | |
| 733 | + | sbi->options = NULL; | |
| 734 | + | } | |
| 735 | + | ||
| 743 | 736 | ntfs3_put_sbi(sbi); | |
| 744 | 737 | } | |
| 745 | 738 | ||
| @@ -1946,11 +1939,9 @@ static void ntfs3_kill_sb(struct super_block *sb) | |||
| 1946 | 1939 | ||
| 1947 | 1940 | kill_block_super(sb); | |
| 1948 | 1941 | ||
| 1949 | - | /* | |
| 1950 | - | * A pathwalk in rcu mode may still be in ->d_hash() or ->d_compare() | |
| 1951 | - | * and read the upcase table and the nls table through the sbi. | |
| 1952 | - | */ | |
| 1953 | - | call_rcu(&sbi->rcu, ntfs3_free_sbi_rcu); | |
| 1942 | + | if (sbi->options) | |
| 1943 | + | put_mount_options(sbi->options); | |
| 1944 | + | ntfs3_free_sbi(sbi); | |
| 1954 | 1945 | } | |
| 1955 | 1946 | ||
| 1956 | 1947 | // clang-format off | |
modified fs/ocfs2/dlm/dlmcommon.h
| @@ -435,8 +435,6 @@ enum { | |||
| 435 | 435 | DLM_DEREF_LOCKRES_DONE = 522, | |
| 436 | 436 | }; | |
| 437 | 437 | ||
| 438 | - | extern spinlock_t dlm_reco_state_lock; | |
| 439 | - | ||
| 440 | 438 | struct dlm_reco_node_data | |
| 441 | 439 | { | |
| 442 | 440 | int state; | |
modified fs/ocfs2/dlm/dlmdebug.c
| @@ -736,11 +736,8 @@ static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) | |||
| 736 | 736 | buf + out, len - out); | |
| 737 | 737 | out += scnprintf(buf + out, len - out, "\n"); | |
| 738 | 738 | ||
| 739 | - | spin_unlock(&dlm->spinlock); | |
| 740 | - | ||
| 741 | 739 | /* Recovery Node State: */ | |
| 742 | 740 | out += scnprintf(buf + out, len - out, "Recovery Node State:\n"); | |
| 743 | - | spin_lock(&dlm_reco_state_lock); | |
| 744 | 741 | list_for_each_entry(node, &dlm->reco.node_data, list) { | |
| 745 | 742 | switch (node->state) { | |
| 746 | 743 | case DLM_RECO_NODE_DATA_INIT: | |
| @@ -772,7 +769,7 @@ static int debug_state_print(struct dlm_ctxt *dlm, char *buf, int len) | |||
| 772 | 769 | node->node_num, state); | |
| 773 | 770 | } | |
| 774 | 771 | ||
| 775 | - | spin_unlock(&dlm_reco_state_lock); | |
| 772 | + | spin_unlock(&dlm->spinlock); | |
| 776 | 773 | ||
| 777 | 774 | return out; | |
| 778 | 775 | } | |
modified fs/ocfs2/dlm/dlmrecovery.c
| @@ -80,7 +80,7 @@ static int dlm_lockres_master_requery(struct dlm_ctxt *dlm, | |||
| 80 | 80 | ||
| 81 | 81 | static u64 dlm_get_next_mig_cookie(void); | |
| 82 | 82 | ||
| 83 | - | DEFINE_SPINLOCK(dlm_reco_state_lock); | |
| 83 | + | static DEFINE_SPINLOCK(dlm_reco_state_lock); | |
| 84 | 84 | static DEFINE_SPINLOCK(dlm_mig_cookie_lock); | |
| 85 | 85 | static u64 dlm_mig_cookie = 1; | |
| 86 | 86 | ||
modified fs/pipe.c
| @@ -838,11 +838,9 @@ pipe_fasync(int fd, struct file *filp, int on) | |||
| 838 | 838 | if (filp->f_mode & FMODE_READ) | |
| 839 | 839 | retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); | |
| 840 | 840 | if ((filp->f_mode & FMODE_WRITE) && retval >= 0) { | |
| 841 | - | int read_ret = retval; | |
| 842 | - | ||
| 843 | 841 | retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); | |
| 844 | - | /* Undo only a reader entry added by this call. */ | |
| 845 | - | if (retval < 0 && read_ret > 0) | |
| 842 | + | if (retval < 0 && (filp->f_mode & FMODE_READ)) | |
| 843 | + | /* this can happen only if on == T */ | |
| 846 | 844 | fasync_helper(-1, filp, 0, &pipe->fasync_readers); | |
| 847 | 845 | } | |
| 848 | 846 | mutex_unlock(&pipe->mutex); | |
modified fs/tracefs/event_inode.c
| @@ -91,14 +91,6 @@ static void free_ei_rcu(struct rcu_head *rcu) | |||
| 91 | 91 | } | |
| 92 | 92 | } | |
| 93 | 93 | ||
| 94 | - | /* read under eventfs_srcu and, by tracefs_d_revalidate(), in rcu pathwalk */ | |
| 95 | - | static void free_ei_srcu(struct rcu_head *rcu) | |
| 96 | - | { | |
| 97 | - | struct eventfs_inode *ei = container_of(rcu, struct eventfs_inode, rcu); | |
| 98 | - | ||
| 99 | - | call_rcu(&ei->rcu, free_ei_rcu); | |
| 100 | - | } | |
| 101 | - | ||
| 102 | 94 | /* | |
| 103 | 95 | * eventfs_inode reference count management. | |
| 104 | 96 | * | |
| @@ -120,7 +112,7 @@ static void release_ei(struct kref *ref) | |||
| 120 | 112 | entry->release(entry->name, ei->data); | |
| 121 | 113 | } | |
| 122 | 114 | ||
| 123 | - | call_srcu(&eventfs_srcu, &ei->rcu, free_ei_srcu); | |
| 115 | + | call_srcu(&eventfs_srcu, &ei->rcu, free_ei_rcu); | |
| 124 | 116 | } | |
| 125 | 117 | ||
| 126 | 118 | static inline void put_ei(struct eventfs_inode *ei) | |
modified fs/unicode/utf8-core.c
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | #include <linux/kernel.h> | |
| 4 | 4 | #include <linux/string.h> | |
| 5 | 5 | #include <linux/slab.h> | |
| 6 | - | #include <linux/rcupdate.h> | |
| 7 | 6 | #include <linux/parser.h> | |
| 8 | 7 | #include <linux/errno.h> | |
| 9 | 8 | #include <linux/stringhash.h> | |
| @@ -184,24 +183,12 @@ out_free_um: | |||
| 184 | 183 | } | |
| 185 | 184 | EXPORT_SYMBOL(utf8_load); | |
| 186 | 185 | ||
| 187 | - | static void utf8_unload_rcu(struct rcu_head *head) | |
| 188 | - | { | |
| 189 | - | struct unicode_map *um = container_of(head, struct unicode_map, rcu); | |
| 190 | - | ||
| 191 | - | symbol_put(utf8_data_table); | |
| 192 | - | kfree(um); | |
| 193 | - | } | |
| 194 | - | ||
| 195 | - | /* | |
| 196 | - | * A pathwalk in rcu mode may still be in ->d_hash() or ->d_compare() of a | |
| 197 | - | * filesystem that is being torn down and read the map through its | |
| 198 | - | * superblock, so the map and the tables it points to have to outlive the | |
| 199 | - | * grace period. | |
| 200 | - | */ | |
| 201 | 186 | void utf8_unload(struct unicode_map *um) | |
| 202 | 187 | { | |
| 203 | - | if (um) | |
| 204 | - | call_rcu(&um->rcu, utf8_unload_rcu); | |
| 188 | + | if (um) { | |
| 189 | + | symbol_put(utf8_data_table); | |
| 190 | + | kfree(um); | |
| 191 | + | } | |
| 205 | 192 | } | |
| 206 | 193 | EXPORT_SYMBOL(utf8_unload); | |
| 207 | 194 | ||
modified include/linux/sched/signal.h
| @@ -130,8 +130,8 @@ struct signal_struct { | |||
| 130 | 130 | * process will inherit a flag if they should look for a | |
| 131 | 131 | * child_subreaper process at exit. | |
| 132 | 132 | */ | |
| 133 | - | bool is_child_subreaper; | |
| 134 | - | bool has_child_subreaper; | |
| 133 | + | unsigned int is_child_subreaper:1; | |
| 134 | + | unsigned int has_child_subreaper:1; | |
| 135 | 135 | unsigned int autoreap:1; | |
| 136 | 136 | ||
| 137 | 137 | #ifdef CONFIG_POSIX_TIMERS | |
modified include/linux/unicode.h
| @@ -53,7 +53,6 @@ struct unicode_map { | |||
| 53 | 53 | unsigned int version; | |
| 54 | 54 | const struct utf8data *ntab[UTF8_NMAX]; | |
| 55 | 55 | const struct utf8data_table *tables; | |
| 56 | - | struct rcu_head rcu; | |
| 57 | 56 | }; | |
| 58 | 57 | ||
| 59 | 58 | int utf8_validate(const struct unicode_map *um, const struct qstr *str); | |
modified ipc/namespace.c
| @@ -96,7 +96,7 @@ fail_ipc: | |||
| 96 | 96 | fail_mq_sysctls: | |
| 97 | 97 | retire_mq_sysctls(ns); | |
| 98 | 98 | fail_mq_mount: | |
| 99 | - | kern_unmount(ns->mq_mnt); | |
| 99 | + | mntput(ns->mq_mnt); | |
| 100 | 100 | fail_put: | |
| 101 | 101 | put_user_ns(ns->user_ns); | |
| 102 | 102 | ns_common_free(ns); | |
modified kernel/watch_queue.c
| @@ -101,7 +101,7 @@ static bool post_one_notification(struct watch_queue *wqueue, | |||
| 101 | 101 | struct pipe_inode_info *pipe = wqueue->pipe; | |
| 102 | 102 | struct pipe_buffer *buf; | |
| 103 | 103 | struct page *page; | |
| 104 | - | unsigned int head, tail, note, offset, len, nr_notes; | |
| 104 | + | unsigned int head, tail, note, offset, len; | |
| 105 | 105 | bool done = false; | |
| 106 | 106 | ||
| 107 | 107 | spin_lock_irq(&pipe->rd_wait.lock); | |
| @@ -111,10 +111,8 @@ static bool post_one_notification(struct watch_queue *wqueue, | |||
| 111 | 111 | if (pipe_full(head, tail, pipe->ring_size)) | |
| 112 | 112 | goto lost; | |
| 113 | 113 | ||
| 114 | - | /* Pairs with the smp_store_release() in watch_queue_set_size(). */ | |
| 115 | - | nr_notes = smp_load_acquire(&wqueue->nr_notes); | |
| 116 | - | note = find_first_bit(wqueue->notes_bitmap, nr_notes); | |
| 117 | - | if (note >= nr_notes) | |
| 114 | + | note = find_first_bit(wqueue->notes_bitmap, wqueue->nr_notes); | |
| 115 | + | if (note >= wqueue->nr_notes) | |
| 118 | 116 | goto lost; | |
| 119 | 117 | ||
| 120 | 118 | page = wqueue->notes[note / WATCH_QUEUE_NOTES_PER_PAGE]; | |
| @@ -299,8 +297,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) | |||
| 299 | 297 | wqueue->notes = pages; | |
| 300 | 298 | wqueue->notes_bitmap = bitmap; | |
| 301 | 299 | wqueue->nr_pages = nr_pages; | |
| 302 | - | /* Pairs with the smp_load_acquire() in post_one_notification(). */ | |
| 303 | - | smp_store_release(&wqueue->nr_notes, nr_notes); | |
| 300 | + | wqueue->nr_notes = nr_notes; | |
| 304 | 301 | return 0; | |
| 305 | 302 | ||
| 306 | 303 | error_p: | |
modified samples/pidfd/Makefile
| @@ -1,4 +1,4 @@ | |||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 | |
| 2 | - | userprogs-always-y += pidfd-metadata | |
| 2 | + | usertprogs-always-y += pidfd-metadata | |
| 3 | 3 | ||
| 4 | 4 | userccflags += -I usr/include | |