Showing the changes to include/linux (21 of 687 files). Show all
Unified · Split
| @@ -326,10 +326,11 @@ static inline int bitmap_equal(const unsigned long *src1, · 325 unmodified lines | |||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | /** | 328 | /** |
| 329 | * bitmap_or_equal - Check whether the or of two bitnaps is equal to a third | 329 | * bitmap_or_equal - Check whether the or of two bitmaps is equal to a third |
| 330 | * @src1: Pointer to bitmap 1 | 330 | * @src1: Pointer to bitmap 1 |
| 331 | * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1 | 331 | * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1 |
| 332 | * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2 | 332 | * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2 |
| 333 | * @nbits: number of bits in each of these bitmaps | ||
| 333 | * | 334 | * |
| 334 | * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise | 335 | * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise |
| 335 | */ | 336 | */ |
| @@ -4,6 +4,13 @@ · 3 unmodified lines | |||
| 4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
| 5 | #include <linux/bits.h> | 5 | #include <linux/bits.h> |
| 6 | 6 | ||
| 7 | /* Set bits in the first 'n' bytes when loaded from memory */ | ||
| 8 | #ifdef __LITTLE_ENDIAN | ||
| 9 | # define aligned_byte_mask(n) ((1UL << 8*(n))-1) | ||
| 10 | #else | ||
| 11 | # define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n))) | ||
| 12 | #endif | ||
| 13 | |||
| 7 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) | 14 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) |
| 8 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) | 15 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) |
| 9 | 16 | ||
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | # define __GCC4_has_attribute___noclone__ 1 | 40 | # define __GCC4_has_attribute___noclone__ 1 |
| 41 | # define __GCC4_has_attribute___nonstring__ 0 | 41 | # define __GCC4_has_attribute___nonstring__ 0 |
| 42 | # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) | 42 | # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) |
| 43 | # define __GCC4_has_attribute___fallthrough__ 0 | ||
| 43 | #endif | 44 | #endif |
| 44 | 45 | ||
| 45 | /* | 46 | /* |
| @@ -185,6 +186,22 @@ · 139 unmodified lines | |||
| 185 | # define __noclone | 186 | # define __noclone |
| 186 | #endif | 187 | #endif |
| 187 | 188 | ||
| 189 | /* | ||
| 190 | * Add the pseudo keyword 'fallthrough' so case statement blocks | ||
| 191 | * must end with any of these keywords: | ||
| 192 | * break; | ||
| 193 | * fallthrough; | ||
| 194 | * goto <label>; | ||
| 195 | * return [expression]; | ||
| 196 | * | ||
| 197 | * gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes | ||
| 198 | */ | ||
| 199 | #if __has_attribute(__fallthrough__) | ||
| 200 | # define fallthrough __attribute__((__fallthrough__)) | ||
| 201 | #else | ||
| 202 | # define fallthrough do {} while (0) /* fallthrough */ | ||
| 203 | #endif | ||
| 204 | |||
| 188 | /* | 205 | /* |
| 189 | * Note the missing underscores. | 206 | * Note the missing underscores. |
| 190 | * | 207 | * |
| @@ -31,6 +31,8 @@ · 30 unmodified lines | |||
| 31 | #define SJA1105_META_SMAC 0x222222222222ull | 31 | #define SJA1105_META_SMAC 0x222222222222ull |
| 32 | #define SJA1105_META_DMAC 0x0180C200000Eull | 32 | #define SJA1105_META_DMAC 0x0180C200000Eull |
| 33 | 33 | ||
| 34 | #define SJA1105_HWTS_RX_EN 0 | ||
| 35 | |||
| 34 | /* Global tagger data: each struct sja1105_port has a reference to | 36 | /* Global tagger data: each struct sja1105_port has a reference to |
| 35 | * the structure defined in struct sja1105_private. | 37 | * the structure defined in struct sja1105_private. |
| 36 | */ | 38 | */ |
| @@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines | |||
| 42 | * from taggers running on multiple ports on SMP systems | 44 | * from taggers running on multiple ports on SMP systems |
| 43 | */ | 45 | */ |
| 44 | spinlock_t meta_lock; | 46 | spinlock_t meta_lock; |
| 45 | bool hwts_rx_en; | 47 | unsigned long state; |
| 46 | }; | 48 | }; |
| 47 | 49 | ||
| 48 | struct sja1105_skb_cb { | 50 | struct sja1105_skb_cb { |
| @@ -52,10 +52,10 @@ extern struct module __this_module; · 51 unmodified lines | |||
| 52 | __ADDRESSABLE(sym) \ | 52 | __ADDRESSABLE(sym) \ |
| 53 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ | 53 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ |
| 54 | " .balign 4 \n" \ | 54 | " .balign 4 \n" \ |
| 55 | "__ksymtab_" #sym NS_SEPARATOR #ns ": \n" \ | 55 | "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \ |
| 56 | " .long " #sym "- . \n" \ | 56 | " .long " #sym "- . \n" \ |
| 57 | " .long __kstrtab_" #sym "- . \n" \ | 57 | " .long __kstrtab_" #sym "- . \n" \ |
| 58 | " .long __kstrtab_ns_" #sym "- . \n" \ | 58 | " .long __kstrtabns_" #sym "- . \n" \ |
| 59 | " .previous \n") | 59 | " .previous \n") |
| 60 | 60 | ||
| 61 | #define __KSYMTAB_ENTRY(sym, sec) \ | 61 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| @@ -76,10 +76,10 @@ struct kernel_symbol { · 14 unmodified lines | |||
| 76 | #else | 76 | #else |
| 77 | #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \ | 77 | #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \ |
| 78 | static const struct kernel_symbol __ksymtab_##sym##__##ns \ | 78 | static const struct kernel_symbol __ksymtab_##sym##__##ns \ |
| 79 | asm("__ksymtab_" #sym NS_SEPARATOR #ns) \ | 79 | asm("__ksymtab_" #ns NS_SEPARATOR #sym) \ |
| 80 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ | 80 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 81 | __aligned(sizeof(void *)) \ | 81 | __aligned(sizeof(void *)) \ |
| 82 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtab_ns_##sym } | 82 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } |
| 83 | 83 | ||
| 84 | #define __KSYMTAB_ENTRY(sym, sec) \ | 84 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 85 | static const struct kernel_symbol __ksymtab_##sym \ | 85 | static const struct kernel_symbol __ksymtab_##sym \ |
| @@ -112,7 +112,7 @@ struct kernel_symbol { · 26 unmodified lines | |||
| 112 | /* For every exported symbol, place a struct in the __ksymtab section */ | 112 | /* For every exported symbol, place a struct in the __ksymtab section */ |
| 113 | #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ | 113 | #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ |
| 114 | ___export_symbol_common(sym, sec); \ | 114 | ___export_symbol_common(sym, sec); \ |
| 115 | static const char __kstrtab_ns_##sym[] \ | 115 | static const char __kstrtabns_##sym[] \ |
| 116 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 116 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 117 | = #ns; \ | 117 | = #ns; \ |
| 118 | __KSYMTAB_ENTRY_NS(sym, sec, ns) | 118 | __KSYMTAB_ENTRY_NS(sym, sec, ns) |
| @@ -235,7 +235,7 @@ enum hwmon_power_attributes { · 234 unmodified lines | |||
| 235 | #define HWMON_P_LABEL BIT(hwmon_power_label) | 235 | #define HWMON_P_LABEL BIT(hwmon_power_label) |
| 236 | #define HWMON_P_ALARM BIT(hwmon_power_alarm) | 236 | #define HWMON_P_ALARM BIT(hwmon_power_alarm) |
| 237 | #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) | 237 | #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm) |
| 238 | #define HWMON_P_MIN_ALARM BIT(hwmon_power_max_alarm) | 238 | #define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm) |
| 239 | #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) | 239 | #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm) |
| 240 | #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm) | 240 | #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm) |
| 241 | #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) | 241 | #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm) |
| @@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines | |||
| 1090 | 1090 | ||
| 1091 | struct kvm_stat_data { | 1091 | struct kvm_stat_data { |
| 1092 | int offset; | 1092 | int offset; |
| 1093 | int mode; | ||
| 1093 | struct kvm *kvm; | 1094 | struct kvm *kvm; |
| 1094 | }; | 1095 | }; |
| 1095 | 1096 | ||
| @@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line | |||
| 1097 | const char *name; | 1098 | const char *name; |
| 1098 | int offset; | 1099 | int offset; |
| 1099 | enum kvm_stat_kind kind; | 1100 | enum kvm_stat_kind kind; |
| 1101 | int mode; | ||
| 1100 | }; | 1102 | }; |
| 1101 | extern struct kvm_stats_debugfs_item debugfs_entries[]; | 1103 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
| 1102 | extern struct dentry *kvm_debugfs_dir; | 1104 | extern struct dentry *kvm_debugfs_dir; |
| @@ -247,7 +247,7 @@ extern void led_set_brightness(struct led_classdev *led_cdev, · 246 unmodified lines | |||
| 247 | /** | 247 | /** |
| 248 | * led_set_brightness_sync - set LED brightness synchronously | 248 | * led_set_brightness_sync - set LED brightness synchronously |
| 249 | * @led_cdev: the LED to set | 249 | * @led_cdev: the LED to set |
| 250 | * @brightness: the brightness to set it to | 250 | * @value: the brightness to set it to |
| 251 | * | 251 | * |
| 252 | * Set an LED's brightness immediately. This function will block | 252 | * Set an LED's brightness immediately. This function will block |
| 253 | * the caller for the time required for accessing device registers, | 253 | * the caller for the time required for accessing device registers, |
| @@ -301,8 +301,7 @@ extern void led_sysfs_enable(struct led_classdev *led_cdev); · 47 unmodified lines | |||
| 301 | /** | 301 | /** |
| 302 | * led_compose_name - compose LED class device name | 302 | * led_compose_name - compose LED class device name |
| 303 | * @dev: LED controller device object | 303 | * @dev: LED controller device object |
| 304 | * @child: child fwnode_handle describing a LED or a group of synchronized LEDs; | 304 | * @init_data: the LED class device initialization data |
| 305 | * it must be provided only for fwnode based LEDs | ||
| 306 | * @led_classdev_name: composed LED class device name | 305 | * @led_classdev_name: composed LED class device name |
| 307 | * | 306 | * |
| 308 | * Create LED class device name basing on the provided init_data argument. | 307 | * Create LED class device name basing on the provided init_data argument. |
| @@ -356,6 +356,19 @@ static inline bool mem_cgroup_disabled(void) · 355 unmodified lines | |||
| 356 | return !cgroup_subsys_enabled(memory_cgrp_subsys); | 356 | return !cgroup_subsys_enabled(memory_cgrp_subsys); |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg, | ||
| 360 | bool in_low_reclaim) | ||
| 361 | { | ||
| 362 | if (mem_cgroup_disabled()) | ||
| 363 | return 0; | ||
| 364 | |||
| 365 | if (in_low_reclaim) | ||
| 366 | return READ_ONCE(memcg->memory.emin); | ||
| 367 | |||
| 368 | return max(READ_ONCE(memcg->memory.emin), | ||
| 369 | READ_ONCE(memcg->memory.elow)); | ||
| 370 | } | ||
| 371 | |||
| 359 | enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, | 372 | enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, |
| 360 | struct mem_cgroup *memcg); | 373 | struct mem_cgroup *memcg); |
| 361 | 374 | ||
| @@ -537,6 +550,8 @@ void mem_cgroup_handle_over_high(void); · 175 unmodified lines | |||
| 537 | 550 | ||
| 538 | unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg); | 551 | unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg); |
| 539 | 552 | ||
| 553 | unsigned long mem_cgroup_size(struct mem_cgroup *memcg); | ||
| 554 | |||
| 540 | void mem_cgroup_print_oom_context(struct mem_cgroup *memcg, | 555 | void mem_cgroup_print_oom_context(struct mem_cgroup *memcg, |
| 541 | struct task_struct *p); | 556 | struct task_struct *p); |
| 542 | 557 | ||
| @@ -829,6 +844,12 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm, · 286 unmodified lines | |||
| 829 | { | 844 | { |
| 830 | } | 845 | } |
| 831 | 846 | ||
| 847 | static inline unsigned long mem_cgroup_protection(struct mem_cgroup *memcg, | ||
| 848 | bool in_low_reclaim) | ||
| 849 | { | ||
| 850 | return 0; | ||
| 851 | } | ||
| 852 | |||
| 832 | static inline enum mem_cgroup_protection mem_cgroup_protected( | 853 | static inline enum mem_cgroup_protection mem_cgroup_protected( |
| 833 | struct mem_cgroup *root, struct mem_cgroup *memcg) | 854 | struct mem_cgroup *root, struct mem_cgroup *memcg) |
| 834 | { | 855 | { |
| @@ -968,6 +989,11 @@ static inline unsigned long mem_cgroup_get_max(struct mem_cgroup *memcg) · 133 unmodified lines | |||
| 968 | return 0; | 989 | return 0; |
| 969 | } | 990 | } |
| 970 | 991 | ||
| 992 | static inline unsigned long mem_cgroup_size(struct mem_cgroup *memcg) | ||
| 993 | { | ||
| 994 | return 0; | ||
| 995 | } | ||
| 996 | |||
| 971 | static inline void | 997 | static inline void |
| 972 | mem_cgroup_print_oom_context(struct mem_cgroup *memcg, struct task_struct *p) | 998 | mem_cgroup_print_oom_context(struct mem_cgroup *memcg, struct task_struct *p) |
| 973 | { | 999 | { |
| @@ -1264,6 +1290,9 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page, · 290 unmodified lines | |||
| 1264 | static inline void mem_cgroup_track_foreign_dirty(struct page *page, | 1290 | static inline void mem_cgroup_track_foreign_dirty(struct page *page, |
| 1265 | struct bdi_writeback *wb) | 1291 | struct bdi_writeback *wb) |
| 1266 | { | 1292 | { |
| 1293 | if (mem_cgroup_disabled()) | ||
| 1294 | return; | ||
| 1295 | |||
| 1267 | if (unlikely(&page->mem_cgroup->css != wb->memcg_css)) | 1296 | if (unlikely(&page->mem_cgroup->css != wb->memcg_css)) |
| 1268 | mem_cgroup_track_foreign_dirty_slowpath(page, wb); | 1297 | mem_cgroup_track_foreign_dirty_slowpath(page, wb); |
| 1269 | } | 1298 | } |
| @@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines | |||
| 455 | lp_advertising, lpa & LPA_LPACK); | 455 | lp_advertising, lpa & LPA_LPACK); |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising, | ||
| 459 | u32 ctrl1000) | ||
| 460 | { | ||
| 461 | linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising, | ||
| 462 | ctrl1000 & ADVERTISE_1000HALF); | ||
| 463 | linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising, | ||
| 464 | ctrl1000 & ADVERTISE_1000FULL); | ||
| 465 | } | ||
| 466 | |||
| 458 | /** | 467 | /** |
| 459 | * linkmode_adv_to_lcl_adv_t | 468 | * linkmode_adv_to_lcl_adv_t |
| 460 | * @advertising:pointer to linkmode advertising | 469 | * @advertising:pointer to linkmode advertising |
| @@ -18,7 +18,7 @@ struct page_ext_operations { · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | enum page_ext_flags { | 19 | enum page_ext_flags { |
| 20 | PAGE_EXT_OWNER, | 20 | PAGE_EXT_OWNER, |
| 21 | PAGE_EXT_OWNER_ACTIVE, | 21 | PAGE_EXT_OWNER_ALLOCATED, |
| 22 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) | 22 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) |
| 23 | PAGE_EXT_YOUNG, | 23 | PAGE_EXT_YOUNG, |
| 24 | PAGE_EXT_IDLE, | 24 | PAGE_EXT_IDLE, |
| @@ -36,6 +36,7 @@ struct page_ext { · 11 unmodified lines | |||
| 36 | unsigned long flags; | 36 | unsigned long flags; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | extern unsigned long page_ext_size; | ||
| 39 | extern void pgdat_page_ext_init(struct pglist_data *pgdat); | 40 | extern void pgdat_page_ext_init(struct pglist_data *pgdat); |
| 40 | 41 | ||
| 41 | #ifdef CONFIG_SPARSEMEM | 42 | #ifdef CONFIG_SPARSEMEM |
| @@ -52,6 +53,13 @@ static inline void page_ext_init(void) · 10 unmodified lines | |||
| 52 | 53 | ||
| 53 | struct page_ext *lookup_page_ext(const struct page *page); | 54 | struct page_ext *lookup_page_ext(const struct page *page); |
| 54 | 55 | ||
| 56 | static inline struct page_ext *page_ext_next(struct page_ext *curr) | ||
| 57 | { | ||
| 58 | void *next = curr; | ||
| 59 | next += page_ext_size; | ||
| 60 | return next; | ||
| 61 | } | ||
| 62 | |||
| 55 | #else /* !CONFIG_PAGE_EXTENSION */ | 63 | #else /* !CONFIG_PAGE_EXTENSION */ |
| 56 | struct page_ext; | 64 | struct page_ext; |
| 57 | 65 | ||
| @@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines | |||
| 678 | return phydev->state >= PHY_UP; | 678 | return phydev->state >= PHY_UP; |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | void phy_resolve_aneg_pause(struct phy_device *phydev); | ||
| 681 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); | 682 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); |
| 682 | 683 | ||
| 683 | /** | 684 | /** |
| @@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines | |||
| 1076 | int __genphy_config_aneg(struct phy_device *phydev, bool changed); | 1077 | int __genphy_config_aneg(struct phy_device *phydev, bool changed); |
| 1077 | int genphy_aneg_done(struct phy_device *phydev); | 1078 | int genphy_aneg_done(struct phy_device *phydev); |
| 1078 | int genphy_update_link(struct phy_device *phydev); | 1079 | int genphy_update_link(struct phy_device *phydev); |
| 1080 | int genphy_read_lpa(struct phy_device *phydev); | ||
| 1079 | int genphy_read_status(struct phy_device *phydev); | 1081 | int genphy_read_status(struct phy_device *phydev); |
| 1080 | int genphy_suspend(struct phy_device *phydev); | 1082 | int genphy_suspend(struct phy_device *phydev); |
| 1081 | int genphy_resume(struct phy_device *phydev); | 1083 | int genphy_resume(struct phy_device *phydev); |
| @@ -64,6 +64,8 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, · 63 unmodified lines | |||
| 64 | unsigned int, | 64 | unsigned int, |
| 65 | const char *); | 65 | const char *); |
| 66 | extern int platform_get_irq_byname(struct platform_device *, const char *); | 66 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
| 67 | extern int platform_get_irq_byname_optional(struct platform_device *dev, | ||
| 68 | const char *name); | ||
| 67 | extern int platform_add_devices(struct platform_device **, int); | 69 | extern int platform_add_devices(struct platform_device **, int); |
| 68 | 70 | ||
| 69 | struct platform_device_info { | 71 | struct platform_device_info { |
| @@ -97,7 +97,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot); · 96 unmodified lines | |||
| 97 | 97 | ||
| 98 | int dquot_file_open(struct inode *inode, struct file *file); | 98 | int dquot_file_open(struct inode *inode, struct file *file); |
| 99 | 99 | ||
| 100 | int dquot_enable(struct inode *inode, int type, int format_id, | 100 | int dquot_load_quota_sb(struct super_block *sb, int type, int format_id, |
| 101 | unsigned int flags); | ||
| 102 | int dquot_load_quota_inode(struct inode *inode, int type, int format_id, | ||
| 101 | unsigned int flags); | 103 | unsigned int flags); |
| 102 | int dquot_quota_on(struct super_block *sb, int type, int format_id, | 104 | int dquot_quota_on(struct super_block *sb, int type, int format_id, |
| 103 | const struct path *path); | 105 | const struct path *path); |
| @@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} · 4159 unmodified lines | |||
| 4160 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} | 4160 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} |
| 4161 | #endif /* CONFIG_SKB_EXTENSIONS */ | 4161 | #endif /* CONFIG_SKB_EXTENSIONS */ |
| 4162 | 4162 | ||
| 4163 | static inline void nf_reset(struct sk_buff *skb) | 4163 | static inline void nf_reset_ct(struct sk_buff *skb) |
| 4164 | { | 4164 | { |
| 4165 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 4165 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 4166 | nf_conntrack_put(skb_nfct(skb)); | 4166 | nf_conntrack_put(skb_nfct(skb)); |
| 4167 | skb->_nfct = 0; | 4167 | skb->_nfct = 0; |
| 4168 | #endif | 4168 | #endif |
| 4169 | #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | ||
| 4170 | skb_ext_del(skb, SKB_EXT_BRIDGE_NF); | ||
| 4171 | #endif | ||
| 4172 | } | 4169 | } |
| 4173 | 4170 | ||
| 4174 | static inline void nf_reset_trace(struct sk_buff *skb) | 4171 | static inline void nf_reset_trace(struct sk_buff *skb) |
| @@ -493,6 +493,10 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) · 492 unmodified lines | |||
| 493 | * kmalloc is the normal method of allocating memory | 493 | * kmalloc is the normal method of allocating memory |
| 494 | * for objects smaller than page size in the kernel. | 494 | * for objects smaller than page size in the kernel. |
| 495 | * | 495 | * |
| 496 | * The allocated object address is aligned to at least ARCH_KMALLOC_MINALIGN | ||
| 497 | * bytes. For @size of power of two bytes, the alignment is also guaranteed | ||
| 498 | * to be at least to the size. | ||
| 499 | * | ||
| 496 | * The @flags argument may be one of the GFP flags defined at | 500 | * The @flags argument may be one of the GFP flags defined at |
| 497 | * include/linux/gfp.h and described at | 501 | * include/linux/gfp.h and described at |
| 498 | * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>` | 502 | * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>` |
| @@ -227,7 +227,26 @@ static inline bool strstarts(const char *str, const char *prefix) · 226 unmodified lines | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | size_t memweight(const void *ptr, size_t bytes); | 229 | size_t memweight(const void *ptr, size_t bytes); |
| 230 | void memzero_explicit(void *s, size_t count); | 230 | |
| 231 | /** | ||
| 232 | * memzero_explicit - Fill a region of memory (e.g. sensitive | ||
| 233 | * keying data) with 0s. | ||
| 234 | * @s: Pointer to the start of the area. | ||
| 235 | * @count: The size of the area. | ||
| 236 | * | ||
| 237 | * Note: usually using memset() is just fine (!), but in cases | ||
| 238 | * where clearing out _local_ data at the end of a scope is | ||
| 239 | * necessary, memzero_explicit() should be used instead in | ||
| 240 | * order to prevent the compiler from optimising away zeroing. | ||
| 241 | * | ||
| 242 | * memzero_explicit() doesn't need an arch-specific version as | ||
| 243 | * it just invokes the one of memset() implicitly. | ||
| 244 | */ | ||
| 245 | static inline void memzero_explicit(void *s, size_t count) | ||
| 246 | { | ||
| 247 | memset(s, 0, count); | ||
| 248 | barrier_data(s); | ||
| 249 | } | ||
| 231 | 250 | ||
| 232 | /** | 251 | /** |
| 233 | * kbasename - return the last part of a pathname. | 252 | * kbasename - return the last part of a pathname. |
| @@ -61,6 +61,7 @@ struct sock_xprt { · 60 unmodified lines | |||
| 61 | struct mutex recv_mutex; | 61 | struct mutex recv_mutex; |
| 62 | struct sockaddr_storage srcaddr; | 62 | struct sockaddr_storage srcaddr; |
| 63 | unsigned short srcport; | 63 | unsigned short srcport; |
| 64 | int xprt_err; | ||
| 64 | 65 | ||
| 65 | /* | 66 | /* |
| 66 | * UDP socket buffer size parameters | 67 | * UDP socket buffer size parameters |
| @@ -152,7 +152,7 @@ struct tcg_algorithm_info { · 151 unmodified lines | |||
| 152 | * total. Once we've done this we know the offset of the data length field, | 152 | * total. Once we've done this we know the offset of the data length field, |
| 153 | * and can calculate the total size of the event. | 153 | * and can calculate the total size of the event. |
| 154 | * | 154 | * |
| 155 | * Return: size of the event on success, <0 on failure | 155 | * Return: size of the event on success, 0 on failure |
| 156 | */ | 156 | */ |
| 157 | 157 | ||
| 158 | static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, | 158 | static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, |
| @@ -170,6 +170,7 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 11 unmodified lines | |||
| 170 | u16 halg; | 170 | u16 halg; |
| 171 | int i; | 171 | int i; |
| 172 | int j; | 172 | int j; |
| 173 | u32 count, event_type; | ||
| 173 | 174 | ||
| 174 | marker = event; | 175 | marker = event; |
| 175 | marker_start = marker; | 176 | marker_start = marker; |
| @@ -190,16 +191,22 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 14 unmodified lines | |||
| 190 | } | 191 | } |
| 191 | 192 | ||
| 192 | event = (struct tcg_pcr_event2_head *)mapping; | 193 | event = (struct tcg_pcr_event2_head *)mapping; |
| 194 | /* | ||
| 195 | * The loop below will unmap these fields if the log is larger than | ||
| 196 | * one page, so save them here for reference: | ||
| 197 | */ | ||
| 198 | count = READ_ONCE(event->count); | ||
| 199 | event_type = READ_ONCE(event->event_type); | ||
| 193 | 200 | ||
| 194 | efispecid = (struct tcg_efi_specid_event_head *)event_header->event; | 201 | efispecid = (struct tcg_efi_specid_event_head *)event_header->event; |
| 195 | 202 | ||
| 196 | /* Check if event is malformed. */ | 203 | /* Check if event is malformed. */ |
| 197 | if (event->count > efispecid->num_algs) { | 204 | if (count > efispecid->num_algs) { |
| 198 | size = 0; | 205 | size = 0; |
| 199 | goto out; | 206 | goto out; |
| 200 | } | 207 | } |
| 201 | 208 | ||
| 202 | for (i = 0; i < event->count; i++) { | 209 | for (i = 0; i < count; i++) { |
| 203 | halg_size = sizeof(event->digests[i].alg_id); | 210 | halg_size = sizeof(event->digests[i].alg_id); |
| 204 | 211 | ||
| 205 | /* Map the digest's algorithm identifier */ | 212 | /* Map the digest's algorithm identifier */ |
| @@ -256,8 +263,9 @@ static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, · 50 unmodified lines | |||
| 256 | + event_field->event_size; | 263 | + event_field->event_size; |
| 257 | size = marker - marker_start; | 264 | size = marker - marker_start; |
| 258 | 265 | ||
| 259 | if ((event->event_type == 0) && (event_field->event_size == 0)) | 266 | if (event_type == 0 && event_field->event_size == 0) |
| 260 | size = 0; | 267 | size = 0; |
| 268 | |||
| 261 | out: | 269 | out: |
| 262 | if (do_mapping) | 270 | if (do_mapping) |
| 263 | TPM_MEMUNMAP(mapping, mapping_size); | 271 | TPM_MEMUNMAP(mapping, mapping_size); |
| @@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from, · 230 unmodified lines | |||
| 231 | 231 | ||
| 232 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ | 232 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ |
| 233 | 233 | ||
| 234 | extern __must_check int check_zeroed_user(const void __user *from, size_t size); | ||
| 235 | |||
| 236 | /** | ||
| 237 | * copy_struct_from_user: copy a struct from userspace | ||
| 238 | * @dst: Destination address, in kernel space. This buffer must be @ksize | ||
| 239 | * bytes long. | ||
| 240 | * @ksize: Size of @dst struct. | ||
| 241 | * @src: Source address, in userspace. | ||
| 242 | * @usize: (Alleged) size of @src struct. | ||
| 243 | * | ||
| 244 | * Copies a struct from userspace to kernel space, in a way that guarantees | ||
| 245 | * backwards-compatibility for struct syscall arguments (as long as future | ||
| 246 | * struct extensions are made such that all new fields are *appended* to the | ||
| 247 | * old struct, and zeroed-out new fields have the same meaning as the old | ||
| 248 | * struct). | ||
| 249 | * | ||
| 250 | * @ksize is just sizeof(*dst), and @usize should've been passed by userspace. | ||
| 251 | * The recommended usage is something like the following: | ||
| 252 | * | ||
| 253 | * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize) | ||
| 254 | * { | ||
| 255 | * int err; | ||
| 256 | * struct foo karg = {}; | ||
| 257 | * | ||
| 258 | * if (usize > PAGE_SIZE) | ||
| 259 | * return -E2BIG; | ||
| 260 | * if (usize < FOO_SIZE_VER0) | ||
| 261 | * return -EINVAL; | ||
| 262 | * | ||
| 263 | * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize); | ||
| 264 | * if (err) | ||
| 265 | * return err; | ||
| 266 | * | ||
| 267 | * // ... | ||
| 268 | * } | ||
| 269 | * | ||
| 270 | * There are three cases to consider: | ||
| 271 | * * If @usize == @ksize, then it's copied verbatim. | ||
| 272 | * * If @usize < @ksize, then the userspace has passed an old struct to a | ||
| 273 | * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize) | ||
| 274 | * are to be zero-filled. | ||
| 275 | * * If @usize > @ksize, then the userspace has passed a new struct to an | ||
| 276 | * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize) | ||
| 277 | * are checked to ensure they are zeroed, otherwise -E2BIG is returned. | ||
| 278 | * | ||
| 279 | * Returns (in all cases, some data may have been copied): | ||
| 280 | * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src. | ||
| 281 | * * -EFAULT: access to userspace failed. | ||
| 282 | */ | ||
| 283 | static __always_inline __must_check int | ||
| 284 | copy_struct_from_user(void *dst, size_t ksize, const void __user *src, | ||
| 285 | size_t usize) | ||
| 286 | { | ||
| 287 | size_t size = min(ksize, usize); | ||
| 288 | size_t rest = max(ksize, usize) - size; | ||
| 289 | |||
| 290 | /* Deal with trailing bytes. */ | ||
| 291 | if (usize < ksize) { | ||
| 292 | memset(dst + size, 0, rest); | ||
| 293 | } else if (usize > ksize) { | ||
| 294 | int ret = check_zeroed_user(src + size, rest); | ||
| 295 | if (ret <= 0) | ||
| 296 | return ret ?: -E2BIG; | ||
| 297 | } | ||
| 298 | /* Copy the interoperable parts of the struct. */ | ||
| 299 | if (copy_from_user(dst, src, size)) | ||
| 300 | return -EFAULT; | ||
| 301 | return 0; | ||
| 302 | } | ||
| 303 | |||
| 234 | /* | 304 | /* |
| 235 | * probe_kernel_read(): safely attempt to read from a location | 305 | * probe_kernel_read(): safely attempt to read from a location |
| 236 | * @dst: pointer to the buffer that shall take the data | 306 | * @dst: pointer to the buffer that shall take the data |
| @@ -285,8 +355,10 @@ extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count); · 48 unmodified lines | |||
| 285 | #ifndef user_access_begin | 355 | #ifndef user_access_begin |
| 286 | #define user_access_begin(ptr,len) access_ok(ptr, len) | 356 | #define user_access_begin(ptr,len) access_ok(ptr, len) |
| 287 | #define user_access_end() do { } while (0) | 357 | #define user_access_end() do { } while (0) |
| 288 | #define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0) | 358 | #define unsafe_op_wrap(op, err) do { if (unlikely(op)) goto err; } while (0) |
| 289 | #define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0) | 359 | #define unsafe_get_user(x,p,e) unsafe_op_wrap(__get_user(x,p),e) |
| 360 | #define unsafe_put_user(x,p,e) unsafe_op_wrap(__put_user(x,p),e) | ||
| 361 | #define unsafe_copy_to_user(d,s,l,e) unsafe_op_wrap(__copy_to_user(d,s,l),e) | ||
| 290 | static inline unsigned long user_access_save(void) { return 0UL; } | 362 | static inline unsigned long user_access_save(void) { return 0UL; } |
| 291 | static inline void user_access_restore(unsigned long flags) { } | 363 | static inline void user_access_restore(unsigned long flags) { } |
| 292 | #endif | 364 | #endif |
| @@ -230,8 +230,8 @@ static inline int xa_err(void *entry) · 229 unmodified lines | |||
| 230 | * This structure is used either directly or via the XA_LIMIT() macro | 230 | * This structure is used either directly or via the XA_LIMIT() macro |
| 231 | * to communicate the range of IDs that are valid for allocation. | 231 | * to communicate the range of IDs that are valid for allocation. |
| 232 | * Two common ranges are predefined for you: | 232 | * Two common ranges are predefined for you: |
| 233 | * * xa_limit_32b - [0 - UINT_MAX] | 233 | * * xa_limit_32b - [0 - UINT_MAX] |
| 234 | * * xa_limit_31b - [0 - INT_MAX] | 234 | * * xa_limit_31b - [0 - INT_MAX] |
| 235 | */ | 235 | */ |
| 236 | struct xa_limit { | 236 | struct xa_limit { |
| 237 | u32 max; | 237 | u32 max; |