* improve similar pkg suggestions and share code in core-functions for all scripts...
[t2sde.git] / package / kernel / linux / hotfix-mount.patch.sparc64
blobf4a124d62a8a706aa881a92f347155d28fcdcd59
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/linux/hotfix-mount.patch.sparc64
3 # Copyright (C) 2024 The T2 SDE Project
4
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 d563d678aa0 in 2020 causes some page table corruption ot TLB invalidation
15 on sparc, revert for now until is further analyzed.
17 --- b/fs/namespace.c
18 +++ a/fs/namespace.c
19 @@ -3075,7 +3075,7 @@
20  void *copy_mount_options(const void __user * data)
21  {
22         char *copy;
23 +       unsigned size;
24 -       unsigned left, offset;
26         if (!data)
27                 return NULL;
28 @@ -3084,27 +3084,16 @@
29         if (!copy)
30                 return ERR_PTR(-ENOMEM);
32 +       size = PAGE_SIZE - offset_in_page(data);
33 -       left = copy_from_user(copy, data, PAGE_SIZE);
35 +       if (copy_from_user(copy, data, size)) {
36 -       /*
37 -        * Not all architectures have an exact copy_from_user(). Resort to
38 -        * byte at a time.
39 -        */
40 -       offset = PAGE_SIZE - left;
41 -       while (left) {
42 -               char c;
43 -               if (get_user(c, (const char __user *)data + offset))
44 -                       break;
45 -               copy[offset] = c;
46 -               left--;
47 -               offset++;
48 -       }
50 -       if (left == PAGE_SIZE) {
51                 kfree(copy);
52                 return ERR_PTR(-EFAULT);
53         }
54 +       if (size != PAGE_SIZE) {
55 +               if (copy_from_user(copy + size, data + size, PAGE_SIZE - size))
56 +                       memset(copy + size, 0, PAGE_SIZE - size);
57 +       }
59         return copy;
60  }