summaryrefslogtreecommitdiff
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2020-09-12 12:06:23 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2020-09-12 12:06:23 +0200
commit5fd2d19eeb9767339e1338eb6789495d1812065b (patch)
tree175a258093131acb0832d165dd403ab296440a27 /mm/hugetlb.c
parent709199f38bc2a38879e7b9fd3a79ceb9311305ef (diff)
parent42b5f72fbe6b5f9c63207f3f6152673c6c9af451 (diff)
Merge 4.4.236 into android-4.4-p
Changes in 4.4.236 HID: core: Correctly handle ReportSize being zero HID: core: Sanitize event code and type when mapping input perf record/stat: Explicitly call out event modifiers in the documentation mm, page_alloc: remove unnecessary variable from free_pcppages_bulk hwmon: (applesmc) check status earlier. ceph: don't allow setlease on cephfs s390: don't trace preemption in percpu macros xen/xenbus: Fix granting of vmalloc'd memory dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling batman-adv: Avoid uninitialized chaddr when handling DHCP batman-adv: bla: use netif_rx_ni when not in interrupt context dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate() netfilter: nf_tables: incorrect enum nft_list_attributes definition netfilter: nf_tables: fix destination register zeroing dmaengine: pl330: Fix burst length if burst size is smaller than bus width bnxt_en: Check for zero dir entries in NVRAM. fix regression in "epoll: Keep a reference on files added to the check list" tg3: Fix soft lockup when tg3_reset_task() fails. iommu/vt-d: Serialize IOMMU GCMD register modifications thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430 include/linux/log2.h: add missing () around n in roundup_pow_of_two() btrfs: drop path before adding new uuid tree entry btrfs: Remove redundant extent_buffer_get in get_old_root btrfs: Remove extraneous extent_buffer_get from tree_mod_log_rewind btrfs: set the lockdep class for log tree extent buffers uaccess: Add non-pagefault user-space read functions uaccess: Add non-pagefault user-space write function btrfs: fix potential deadlock in the search ioctl net: qmi_wwan: MDM9x30 specific power management net: qmi_wwan: support "raw IP" mode net: qmi_wwan: should hold RTNL while changing netdev type net: qmi_wwan: ignore bogus CDC Union descriptors Add Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card (rev3) to qmi_wwan qmi_wwan: Added support for Gemalto's Cinterion PHxx WWAN interface qmi_wwan: add support for Quectel EC21 and EC25 NET: usb: qmi_wwan: add support for Telit LE922A PID 0x1040 drivers: net: usb: qmi_wwan: add QMI_QUIRK_SET_DTR for Telit PID 0x1201 usb: qmi_wwan: add D-Link DWM-222 A2 device ID net: usb: qmi_wwan: add Telit ME910 support net: usb: qmi_wwan: add Telit 0x1050 composition ALSA: ca0106: fix error code handling ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check dm cache metadata: Avoid returning cmd->bm wild pointer on error dm thin metadata: Avoid returning cmd->bm wild pointer on error net: refactor bind_bucket fastreuse into helper net: initialize fastreuse on inet_inherit_port checkpatch: fix the usage of capture group ( ... ) mm/hugetlb: fix a race between hugetlb sysctl handlers cfg80211: regulatory: reject invalid hints net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() ALSA: firewire-digi00x: add support for console models of Digi00x series ALSA: firewire-digi00x: exclude Avid Adrenaline from detection ALSA; firewire-tascam: exclude Tascam FE-8 from detection fs/affs: use octal for permissions affs: fix basic permission bits to actually work ravb: Fixed to be able to unload modules net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init() bnxt_en: Failure to update PHY is not fatal condition. bnxt: don't enable NAPI until rings are ready net: usb: dm9601: Add USB ID of Keenetic Plus DSL sctp: not disable bh in the whole sctp_get_port_local() net: disable netpoll on fresh napis Linux 4.4.236 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I45da24ccdf864c8774a1265a5d81685e04add060
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index baac9a09ec0a..44970b17f4fe 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2812,6 +2812,22 @@ static unsigned int cpuset_mems_nr(unsigned int *array)
}
#ifdef CONFIG_SYSCTL
+static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write,
+ void *buffer, size_t *length,
+ loff_t *ppos, unsigned long *out)
+{
+ struct ctl_table dup_table;
+
+ /*
+ * In order to avoid races with __do_proc_doulongvec_minmax(), we
+ * can duplicate the @table and alter the duplicate of it.
+ */
+ dup_table = *table;
+ dup_table.data = out;
+
+ return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos);
+}
+
static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
struct ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
@@ -2823,9 +2839,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
if (!hugepages_supported())
return -ENOTSUPP;
- table->data = &tmp;
- table->maxlen = sizeof(unsigned long);
- ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
+ &tmp);
if (ret)
goto out;
@@ -2869,9 +2884,8 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
if (write && hstate_is_gigantic(h))
return -EINVAL;
- table->data = &tmp;
- table->maxlen = sizeof(unsigned long);
- ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
+ ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
+ &tmp);
if (ret)
goto out;