Skip to content

Commit 5289d9c

Browse files
author
Alex Shi
committed
Merge tag 'v4.4.77' into linux-linaro-lsk-v4.4
This is the 4.4.77 stable release
2 parents 91e52df + 9e0499d commit 5289d9c

61 files changed

Lines changed: 295 additions & 171 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION = 4
22
PATCHLEVEL = 4
3-
SUBLEVEL = 76
3+
SUBLEVEL = 77
44
EXTRAVERSION =
55
NAME = Blurry Fish Butt
66

arch/x86/include/asm/pat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
bool pat_enabled(void);
88
void pat_disable(const char *reason);
99
extern void pat_init(void);
10+
extern void init_cache_modes(void);
1011

1112
extern int reserve_memtype(u64 start, u64 end,
1213
enum page_cache_mode req_pcm, enum page_cache_mode *ret_pcm);

arch/x86/kernel/setup.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,13 @@ void __init setup_arch(char **cmdline_p)
10481048
if (mtrr_trim_uncached_memory(max_pfn))
10491049
max_pfn = e820_end_of_ram_pfn();
10501050

1051+
/*
1052+
* This call is required when the CPU does not support PAT. If
1053+
* mtrr_bp_init() invoked it already via pat_init() the call has no
1054+
* effect.
1055+
*/
1056+
init_cache_modes();
1057+
10511058
#ifdef CONFIG_X86_32
10521059
/* max_low_pfn get updated here */
10531060
find_low_pfn_range();

arch/x86/lib/copy_user_64.S

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ ENTRY(copy_user_generic_unrolled)
8080
movl %edx,%ecx
8181
andl $63,%edx
8282
shrl $6,%ecx
83-
jz 17f
83+
jz .L_copy_short_string
8484
1: movq (%rsi),%r8
8585
2: movq 1*8(%rsi),%r9
8686
3: movq 2*8(%rsi),%r10
@@ -101,7 +101,8 @@ ENTRY(copy_user_generic_unrolled)
101101
leaq 64(%rdi),%rdi
102102
decl %ecx
103103
jnz 1b
104-
17: movl %edx,%ecx
104+
.L_copy_short_string:
105+
movl %edx,%ecx
105106
andl $7,%edx
106107
shrl $3,%ecx
107108
jz 20f
@@ -215,6 +216,8 @@ ENDPROC(copy_user_generic_string)
215216
*/
216217
ENTRY(copy_user_enhanced_fast_string)
217218
ASM_STAC
219+
cmpl $64,%edx
220+
jb .L_copy_short_string /* less then 64 bytes, avoid the costly 'rep' */
218221
movl %edx,%ecx
219222
1: rep
220223
movsb

arch/x86/mm/pat.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,23 @@
3636
#undef pr_fmt
3737
#define pr_fmt(fmt) "" fmt
3838

39-
static bool boot_cpu_done;
40-
41-
static int __read_mostly __pat_enabled = IS_ENABLED(CONFIG_X86_PAT);
42-
static void init_cache_modes(void);
39+
static bool __read_mostly boot_cpu_done;
40+
static bool __read_mostly pat_disabled = !IS_ENABLED(CONFIG_X86_PAT);
41+
static bool __read_mostly pat_initialized;
42+
static bool __read_mostly init_cm_done;
4343

4444
void pat_disable(const char *reason)
4545
{
46-
if (!__pat_enabled)
46+
if (pat_disabled)
4747
return;
4848

4949
if (boot_cpu_done) {
5050
WARN_ONCE(1, "x86/PAT: PAT cannot be disabled after initialization\n");
5151
return;
5252
}
5353

54-
__pat_enabled = 0;
54+
pat_disabled = true;
5555
pr_info("x86/PAT: %s\n", reason);
56-
57-
init_cache_modes();
5856
}
5957

6058
static int __init nopat(char *str)
@@ -66,7 +64,7 @@ early_param("nopat", nopat);
6664

6765
bool pat_enabled(void)
6866
{
69-
return !!__pat_enabled;
67+
return pat_initialized;
7068
}
7169
EXPORT_SYMBOL_GPL(pat_enabled);
7270

@@ -204,6 +202,8 @@ static void __init_cache_modes(u64 pat)
204202
update_cache_mode_entry(i, cache);
205203
}
206204
pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
205+
206+
init_cm_done = true;
207207
}
208208

209209
#define PAT(x, y) ((u64)PAT_ ## y << ((x)*8))
@@ -224,6 +224,7 @@ static void pat_bsp_init(u64 pat)
224224
}
225225

226226
wrmsrl(MSR_IA32_CR_PAT, pat);
227+
pat_initialized = true;
227228

228229
__init_cache_modes(pat);
229230
}
@@ -241,10 +242,9 @@ static void pat_ap_init(u64 pat)
241242
wrmsrl(MSR_IA32_CR_PAT, pat);
242243
}
243244

244-
static void init_cache_modes(void)
245+
void init_cache_modes(void)
245246
{
246247
u64 pat = 0;
247-
static int init_cm_done;
248248

249249
if (init_cm_done)
250250
return;
@@ -286,8 +286,6 @@ static void init_cache_modes(void)
286286
}
287287

288288
__init_cache_modes(pat);
289-
290-
init_cm_done = 1;
291289
}
292290

293291
/**
@@ -305,10 +303,8 @@ void pat_init(void)
305303
u64 pat;
306304
struct cpuinfo_x86 *c = &boot_cpu_data;
307305

308-
if (!pat_enabled()) {
309-
init_cache_modes();
306+
if (pat_disabled)
310307
return;
311-
}
312308

313309
if ((c->x86_vendor == X86_VENDOR_INTEL) &&
314310
(((c->x86 == 0x6) && (c->x86_model <= 0xd)) ||

arch/x86/tools/relocs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,12 @@ static void emit_relocs(int as_text, int use_real_mode)
992992
die("Segment relocations found but --realmode not specified\n");
993993

994994
/* Order the relocations for more efficient processing */
995-
sort_relocs(&relocs16);
996995
sort_relocs(&relocs32);
997996
#if ELF_BITS == 64
998997
sort_relocs(&relocs32neg);
999998
sort_relocs(&relocs64);
999+
#else
1000+
sort_relocs(&relocs16);
10001001
#endif
10011002

10021003
/* Print the relocations */

drivers/base/platform.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static ssize_t driver_override_store(struct device *dev,
807807
const char *buf, size_t count)
808808
{
809809
struct platform_device *pdev = to_platform_device(dev);
810-
char *driver_override, *old = pdev->driver_override, *cp;
810+
char *driver_override, *old, *cp;
811811

812812
if (count > PATH_MAX)
813813
return -EINVAL;
@@ -820,12 +820,15 @@ static ssize_t driver_override_store(struct device *dev,
820820
if (cp)
821821
*cp = '\0';
822822

823+
device_lock(dev);
824+
old = pdev->driver_override;
823825
if (strlen(driver_override)) {
824826
pdev->driver_override = driver_override;
825827
} else {
826828
kfree(driver_override);
827829
pdev->driver_override = NULL;
828830
}
831+
device_unlock(dev);
829832

830833
kfree(old);
831834

@@ -836,8 +839,12 @@ static ssize_t driver_override_show(struct device *dev,
836839
struct device_attribute *attr, char *buf)
837840
{
838841
struct platform_device *pdev = to_platform_device(dev);
842+
ssize_t len;
839843

840-
return sprintf(buf, "%s\n", pdev->driver_override);
844+
device_lock(dev);
845+
len = sprintf(buf, "%s\n", pdev->driver_override);
846+
device_unlock(dev);
847+
return len;
841848
}
842849
static DEVICE_ATTR_RW(driver_override);
843850

drivers/gpu/drm/virtio/virtgpu_object.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
8181
return -ENOMEM;
8282
size = roundup(size, PAGE_SIZE);
8383
ret = drm_gem_object_init(vgdev->ddev, &bo->gem_base, size);
84-
if (ret != 0)
84+
if (ret != 0) {
85+
kfree(bo);
8586
return ret;
87+
}
8688
bo->dumb = false;
8789
virtio_gpu_init_ttm_placement(bo, pinned);
8890

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,6 +2287,10 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
22872287
if (copy_from_user(&cmd, buf, sizeof cmd))
22882288
return -EFAULT;
22892289

2290+
if (cmd.port_num < rdma_start_port(ib_dev) ||
2291+
cmd.port_num > rdma_end_port(ib_dev))
2292+
return -EINVAL;
2293+
22902294
INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
22912295
out_len);
22922296

@@ -2827,6 +2831,10 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
28272831
if (copy_from_user(&cmd, buf, sizeof cmd))
28282832
return -EFAULT;
28292833

2834+
if (cmd.attr.port_num < rdma_start_port(ib_dev) ||
2835+
cmd.attr.port_num > rdma_end_port(ib_dev))
2836+
return -EINVAL;
2837+
28302838
uobj = kmalloc(sizeof *uobj, GFP_KERNEL);
28312839
if (!uobj)
28322840
return -ENOMEM;

drivers/md/md.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors)
18661866
}
18671867
sb = page_address(rdev->sb_page);
18681868
sb->data_size = cpu_to_le64(num_sectors);
1869-
sb->super_offset = rdev->sb_start;
1869+
sb->super_offset = cpu_to_le64(rdev->sb_start);
18701870
sb->sb_csum = calc_sb_1_csum(sb);
18711871
md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
18721872
rdev->sb_page);
@@ -2273,7 +2273,7 @@ static bool does_sb_need_changing(struct mddev *mddev)
22732273
/* Check if any mddev parameters have changed */
22742274
if ((mddev->dev_sectors != le64_to_cpu(sb->size)) ||
22752275
(mddev->reshape_position != le64_to_cpu(sb->reshape_position)) ||
2276-
(mddev->layout != le64_to_cpu(sb->layout)) ||
2276+
(mddev->layout != le32_to_cpu(sb->layout)) ||
22772277
(mddev->raid_disks != le32_to_cpu(sb->raid_disks)) ||
22782278
(mddev->chunk_sectors != le32_to_cpu(sb->chunksize)))
22792279
return true;

0 commit comments

Comments
 (0)