commit:     3337a2802d989a6811e43d50ac0a3f477b6fa64d
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sun May 15 22:08:24 2022 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sun May 15 22:08:24 2022 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=3337a280

Linux patch 5.17.8

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README             |   4 +
 1007_linux-5.17.8.patch | 246 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 250 insertions(+)

diff --git a/0000_README b/0000_README
index cf45e5d3..30109237 100644
--- a/0000_README
+++ b/0000_README
@@ -71,6 +71,10 @@ Patch:  1006_linux-5.17.7.patch
 From:   http://www.kernel.org
 Desc:   Linux 5.17.7
 
+Patch:  1007_linux-5.17.8.patch
+From:   http://www.kernel.org
+Desc:   Linux 5.17.8
+
 Patch:  1500_XATTR_USER_PREFIX.patch
 From:   https://bugs.gentoo.org/show_bug.cgi?id=470644
 Desc:   Support for namespace user.pax.* on tmpfs.

diff --git a/1007_linux-5.17.8.patch b/1007_linux-5.17.8.patch
new file mode 100644
index 00000000..1c8ce1ab
--- /dev/null
+++ b/1007_linux-5.17.8.patch
@@ -0,0 +1,246 @@
+diff --git a/Makefile b/Makefile
+index ce65b393a2b49..3cf179812f0f9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 5
+ PATCHLEVEL = 17
+-SUBLEVEL = 7
++SUBLEVEL = 8
+ EXTRAVERSION =
+ NAME = Superb Owl
+ 
+diff --git a/fs/udf/namei.c b/fs/udf/namei.c
+index 0ed4861b038f6..b3d5f97f16cdb 100644
+--- a/fs/udf/namei.c
++++ b/fs/udf/namei.c
+@@ -75,11 +75,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc 
*cfi,
+ 
+       if (fileident) {
+               if (adinicb || (offset + lfi < 0)) {
+-                      memcpy(udf_get_fi_ident(sfi), fileident, lfi);
++                      memcpy(sfi->impUse + liu, fileident, lfi);
+               } else if (offset >= 0) {
+                       memcpy(fibh->ebh->b_data + offset, fileident, lfi);
+               } else {
+-                      memcpy(udf_get_fi_ident(sfi), fileident, -offset);
++                      memcpy(sfi->impUse + liu, fileident, -offset);
+                       memcpy(fibh->ebh->b_data, fileident - offset,
+                               lfi + offset);
+               }
+@@ -88,11 +88,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc 
*cfi,
+       offset += lfi;
+ 
+       if (adinicb || (offset + padlen < 0)) {
+-              memset(udf_get_fi_ident(sfi) + lfi, 0x00, padlen);
++              memset(sfi->impUse + liu + lfi, 0x00, padlen);
+       } else if (offset >= 0) {
+               memset(fibh->ebh->b_data + offset, 0x00, padlen);
+       } else {
+-              memset(udf_get_fi_ident(sfi) + lfi, 0x00, -offset);
++              memset(sfi->impUse + liu + lfi, 0x00, -offset);
+               memset(fibh->ebh->b_data, 0x00, padlen + offset);
+       }
+ 
+diff --git a/include/net/bluetooth/hci_core.h 
b/include/net/bluetooth/hci_core.h
+index 36d727f94ac29..131514913430a 100644
+--- a/include/net/bluetooth/hci_core.h
++++ b/include/net/bluetooth/hci_core.h
+@@ -36,6 +36,9 @@
+ /* HCI priority */
+ #define HCI_PRIO_MAX  7
+ 
++/* HCI maximum id value */
++#define HCI_MAX_ID 10000
++
+ /* HCI Core structures */
+ struct inquiry_data {
+       bdaddr_t        bdaddr;
+diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h
+index 283c5a7b3f2c8..db6c8588c1d0c 100644
+--- a/include/uapi/linux/rfkill.h
++++ b/include/uapi/linux/rfkill.h
+@@ -184,7 +184,7 @@ struct rfkill_event_ext {
+ #define RFKILL_IOC_NOINPUT    1
+ #define RFKILL_IOCTL_NOINPUT  _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
+ #define RFKILL_IOC_MAX_SIZE   2
+-#define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_EXT_SIZE, 
__u32)
++#define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_MAX_SIZE, 
__u32)
+ 
+ /* and that's all userspace gets */
+ 
+diff --git a/mm/gup.c b/mm/gup.c
+index 7bc1ba9ce4403..41da0bd61bec3 100644
+--- a/mm/gup.c
++++ b/mm/gup.c
+@@ -465,7 +465,7 @@ static int follow_pfn_pte(struct vm_area_struct *vma, 
unsigned long address,
+               pte_t *pte, unsigned int flags)
+ {
+       /* No page to get reference */
+-      if (flags & FOLL_GET)
++      if (flags & (FOLL_GET | FOLL_PIN))
+               return -EFAULT;
+ 
+       if (flags & FOLL_TOUCH) {
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index a1da8757cc9cc..e2dc190c67256 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -5820,7 +5820,8 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
+                       *pagep = NULL;
+                       goto out;
+               }
+-              folio_copy(page_folio(page), page_folio(*pagep));
++              copy_user_huge_page(page, *pagep, dst_addr, dst_vma,
++                                  pages_per_huge_page(h));
+               put_page(*pagep);
+               *pagep = NULL;
+       }
+diff --git a/mm/memory-failure.c b/mm/memory-failure.c
+index 15dcedbc17306..682eedb5ea75b 100644
+--- a/mm/memory-failure.c
++++ b/mm/memory-failure.c
+@@ -707,8 +707,10 @@ static int kill_accessing_process(struct task_struct *p, 
unsigned long pfn,
+                             (void *)&priv);
+       if (ret == 1 && priv.tk.addr)
+               kill_proc(&priv.tk, pfn, flags);
++      else
++              ret = 0;
+       mmap_read_unlock(p->mm);
+-      return ret ? -EFAULT : -EHWPOISON;
++      return ret > 0 ? -EHWPOISON : -EFAULT;
+ }
+ 
+ static const char *action_name[] = {
+diff --git a/mm/memory.c b/mm/memory.c
+index b69afe3dd597a..886925d977592 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -5475,6 +5475,8 @@ long copy_huge_page_from_user(struct page *dst_page,
+               if (rc)
+                       break;
+ 
++              flush_dcache_page(subpage);
++
+               cond_resched();
+       }
+       return ret_val;
+diff --git a/mm/migrate.c b/mm/migrate.c
+index 086a366374678..ac7673e43dda6 100644
+--- a/mm/migrate.c
++++ b/mm/migrate.c
+@@ -916,9 +916,12 @@ static int move_to_new_page(struct page *newpage, struct 
page *page,
+               if (!PageMappingFlags(page))
+                       page->mapping = NULL;
+ 
+-              if (likely(!is_zone_device_page(newpage)))
+-                      flush_dcache_page(newpage);
++              if (likely(!is_zone_device_page(newpage))) {
++                      int i, nr = compound_nr(newpage);
+ 
++                      for (i = 0; i < nr; i++)
++                              flush_dcache_page(newpage + i);
++              }
+       }
+ out:
+       return rc;
+@@ -3082,18 +3085,21 @@ static int establish_migrate_target(int node, 
nodemask_t *used,
+       if (best_distance != -1) {
+               val = node_distance(node, migration_target);
+               if (val > best_distance)
+-                      return NUMA_NO_NODE;
++                      goto out_clear;
+       }
+ 
+       index = nd->nr;
+       if (WARN_ONCE(index >= DEMOTION_TARGET_NODES,
+                     "Exceeds maximum demotion target nodes\n"))
+-              return NUMA_NO_NODE;
++              goto out_clear;
+ 
+       nd->nodes[index] = migration_target;
+       nd->nr++;
+ 
+       return migration_target;
++out_clear:
++      node_clear(migration_target, *used);
++      return NUMA_NO_NODE;
+ }
+ 
+ /*
+diff --git a/mm/mlock.c b/mm/mlock.c
+index 37f969ec68fa4..b565b1aac8d49 100644
+--- a/mm/mlock.c
++++ b/mm/mlock.c
+@@ -838,6 +838,7 @@ int user_shm_lock(size_t size, struct ucounts *ucounts)
+       }
+       if (!get_ucounts(ucounts)) {
+               dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_MEMLOCK, locked);
++              allowed = 0;
+               goto out;
+       }
+       allowed = 1;
+diff --git a/mm/shmem.c b/mm/shmem.c
+index a09b29ec2b45c..7a46419d331d5 100644
+--- a/mm/shmem.c
++++ b/mm/shmem.c
+@@ -2357,8 +2357,10 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
+                               /* don't free the page */
+                               goto out_unacct_blocks;
+                       }
++
++                      flush_dcache_page(page);
+               } else {                /* ZEROPAGE */
+-                      clear_highpage(page);
++                      clear_user_highpage(page, dst_addr);
+               }
+       } else {
+               page = *pagep;
+diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
+index 885e5adb0168d..7259f96faaa0e 100644
+--- a/mm/userfaultfd.c
++++ b/mm/userfaultfd.c
+@@ -153,6 +153,8 @@ static int mcopy_atomic_pte(struct mm_struct *dst_mm,
+                       /* don't free the page */
+                       goto out;
+               }
++
++              flush_dcache_page(page);
+       } else {
+               page = *pagep;
+               *pagep = NULL;
+@@ -628,6 +630,7 @@ retry:
+                               err = -EFAULT;
+                               goto out;
+                       }
++                      flush_dcache_page(page);
+                       goto retry;
+               } else
+                       BUG_ON(page);
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index 2882bc7d79d79..9e9713f7ddb84 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -2554,10 +2554,10 @@ int hci_register_dev(struct hci_dev *hdev)
+        */
+       switch (hdev->dev_type) {
+       case HCI_PRIMARY:
+-              id = ida_simple_get(&hci_index_ida, 0, 0, GFP_KERNEL);
++              id = ida_simple_get(&hci_index_ida, 0, HCI_MAX_ID, GFP_KERNEL);
+               break;
+       case HCI_AMP:
+-              id = ida_simple_get(&hci_index_ida, 1, 0, GFP_KERNEL);
++              id = ida_simple_get(&hci_index_ida, 1, HCI_MAX_ID, GFP_KERNEL);
+               break;
+       default:
+               return -EINVAL;
+@@ -2566,7 +2566,7 @@ int hci_register_dev(struct hci_dev *hdev)
+       if (id < 0)
+               return id;
+ 
+-      sprintf(hdev->name, "hci%d", id);
++      snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
+       hdev->id = id;
+ 
+       BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);

Reply via email to