1 |
commit: cbc948306936e9e0354646f92070d6f7f7c44efd |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 6 14:06:26 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 6 14:06:26 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cbc94830 |
7 |
|
8 |
Linux patch 5.4.151 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1150_linux-5.4.151.patch | 1804 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1808 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index a878738..dd4e25f 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -643,6 +643,10 @@ Patch: 1149_linux-5.4.150.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.150 |
23 |
|
24 |
+Patch: 1150_linux-5.4.151.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.151 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1150_linux-5.4.151.patch b/1150_linux-5.4.151.patch |
33 |
new file mode 100644 |
34 |
index 0000000..5c5dbac |
35 |
--- /dev/null |
36 |
+++ b/1150_linux-5.4.151.patch |
37 |
@@ -0,0 +1,1804 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index c6b3a3d62f6ca..4eeb72027815b 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 150 |
47 |
++SUBLEVEL = 151 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
52 |
+index 9cb3266e148dc..70758f99c9e47 100644 |
53 |
+--- a/arch/x86/events/intel/core.c |
54 |
++++ b/arch/x86/events/intel/core.c |
55 |
+@@ -259,6 +259,7 @@ static struct event_constraint intel_icl_event_constraints[] = { |
56 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0xa8, 0xb0, 0xf), |
57 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0xb7, 0xbd, 0xf), |
58 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xe6, 0xf), |
59 |
++ INTEL_EVENT_CONSTRAINT(0xef, 0xf), |
60 |
+ INTEL_EVENT_CONSTRAINT_RANGE(0xf0, 0xf4, 0xf), |
61 |
+ EVENT_CONSTRAINT_END |
62 |
+ }; |
63 |
+diff --git a/arch/x86/include/asm/kvmclock.h b/arch/x86/include/asm/kvmclock.h |
64 |
+index eceea92990974..6c57651921028 100644 |
65 |
+--- a/arch/x86/include/asm/kvmclock.h |
66 |
++++ b/arch/x86/include/asm/kvmclock.h |
67 |
+@@ -2,6 +2,20 @@ |
68 |
+ #ifndef _ASM_X86_KVM_CLOCK_H |
69 |
+ #define _ASM_X86_KVM_CLOCK_H |
70 |
+ |
71 |
++#include <linux/percpu.h> |
72 |
++ |
73 |
+ extern struct clocksource kvm_clock; |
74 |
+ |
75 |
++DECLARE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); |
76 |
++ |
77 |
++static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) |
78 |
++{ |
79 |
++ return &this_cpu_read(hv_clock_per_cpu)->pvti; |
80 |
++} |
81 |
++ |
82 |
++static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) |
83 |
++{ |
84 |
++ return this_cpu_read(hv_clock_per_cpu); |
85 |
++} |
86 |
++ |
87 |
+ #endif /* _ASM_X86_KVM_CLOCK_H */ |
88 |
+diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c |
89 |
+index 4a0802af2e3e0..d81e34e614e00 100644 |
90 |
+--- a/arch/x86/kernel/kvmclock.c |
91 |
++++ b/arch/x86/kernel/kvmclock.c |
92 |
+@@ -50,18 +50,9 @@ early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); |
93 |
+ static struct pvclock_vsyscall_time_info |
94 |
+ hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE); |
95 |
+ static struct pvclock_wall_clock wall_clock __bss_decrypted; |
96 |
+-static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); |
97 |
+ static struct pvclock_vsyscall_time_info *hvclock_mem; |
98 |
+- |
99 |
+-static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) |
100 |
+-{ |
101 |
+- return &this_cpu_read(hv_clock_per_cpu)->pvti; |
102 |
+-} |
103 |
+- |
104 |
+-static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) |
105 |
+-{ |
106 |
+- return this_cpu_read(hv_clock_per_cpu); |
107 |
+-} |
108 |
++DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); |
109 |
++EXPORT_PER_CPU_SYMBOL_GPL(hv_clock_per_cpu); |
110 |
+ |
111 |
+ /* |
112 |
+ * The wallclock is the time of day when we booted. Since then, some time may |
113 |
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
114 |
+index 8dee243e639f0..73bffd7af15c1 100644 |
115 |
+--- a/block/bfq-iosched.c |
116 |
++++ b/block/bfq-iosched.c |
117 |
+@@ -2523,15 +2523,6 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) |
118 |
+ * are likely to increase the throughput. |
119 |
+ */ |
120 |
+ bfqq->new_bfqq = new_bfqq; |
121 |
+- /* |
122 |
+- * The above assignment schedules the following redirections: |
123 |
+- * each time some I/O for bfqq arrives, the process that |
124 |
+- * generated that I/O is disassociated from bfqq and |
125 |
+- * associated with new_bfqq. Here we increases new_bfqq->ref |
126 |
+- * in advance, adding the number of processes that are |
127 |
+- * expected to be associated with new_bfqq as they happen to |
128 |
+- * issue I/O. |
129 |
+- */ |
130 |
+ new_bfqq->ref += process_refs; |
131 |
+ return new_bfqq; |
132 |
+ } |
133 |
+@@ -2591,10 +2582,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
134 |
+ { |
135 |
+ struct bfq_queue *in_service_bfqq, *new_bfqq; |
136 |
+ |
137 |
+- /* if a merge has already been setup, then proceed with that first */ |
138 |
+- if (bfqq->new_bfqq) |
139 |
+- return bfqq->new_bfqq; |
140 |
+- |
141 |
+ /* |
142 |
+ * Do not perform queue merging if the device is non |
143 |
+ * rotational and performs internal queueing. In fact, such a |
144 |
+@@ -2649,6 +2636,9 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
145 |
+ if (bfq_too_late_for_merging(bfqq)) |
146 |
+ return NULL; |
147 |
+ |
148 |
++ if (bfqq->new_bfqq) |
149 |
++ return bfqq->new_bfqq; |
150 |
++ |
151 |
+ if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) |
152 |
+ return NULL; |
153 |
+ |
154 |
+diff --git a/drivers/cpufreq/cpufreq_governor_attr_set.c b/drivers/cpufreq/cpufreq_governor_attr_set.c |
155 |
+index 66b05a326910e..a6f365b9cc1ad 100644 |
156 |
+--- a/drivers/cpufreq/cpufreq_governor_attr_set.c |
157 |
++++ b/drivers/cpufreq/cpufreq_governor_attr_set.c |
158 |
+@@ -74,8 +74,8 @@ unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *l |
159 |
+ if (count) |
160 |
+ return count; |
161 |
+ |
162 |
+- kobject_put(&attr_set->kobj); |
163 |
+ mutex_destroy(&attr_set->update_lock); |
164 |
++ kobject_put(&attr_set->kobj); |
165 |
+ return 0; |
166 |
+ } |
167 |
+ EXPORT_SYMBOL_GPL(gov_attr_set_put); |
168 |
+diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c |
169 |
+index 7234b95241e91..e826c4b6b3afd 100644 |
170 |
+--- a/drivers/crypto/ccp/ccp-ops.c |
171 |
++++ b/drivers/crypto/ccp/ccp-ops.c |
172 |
+@@ -778,7 +778,7 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
173 |
+ in_place ? DMA_BIDIRECTIONAL |
174 |
+ : DMA_TO_DEVICE); |
175 |
+ if (ret) |
176 |
+- goto e_ctx; |
177 |
++ goto e_aad; |
178 |
+ |
179 |
+ if (in_place) { |
180 |
+ dst = src; |
181 |
+@@ -863,7 +863,7 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
182 |
+ op.u.aes.size = 0; |
183 |
+ ret = cmd_q->ccp->vdata->perform->aes(&op); |
184 |
+ if (ret) |
185 |
+- goto e_dst; |
186 |
++ goto e_final_wa; |
187 |
+ |
188 |
+ if (aes->action == CCP_AES_ACTION_ENCRYPT) { |
189 |
+ /* Put the ciphered tag after the ciphertext. */ |
190 |
+@@ -873,17 +873,19 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) |
191 |
+ ret = ccp_init_dm_workarea(&tag, cmd_q, authsize, |
192 |
+ DMA_BIDIRECTIONAL); |
193 |
+ if (ret) |
194 |
+- goto e_tag; |
195 |
++ goto e_final_wa; |
196 |
+ ret = ccp_set_dm_area(&tag, 0, p_tag, 0, authsize); |
197 |
+- if (ret) |
198 |
+- goto e_tag; |
199 |
++ if (ret) { |
200 |
++ ccp_dm_free(&tag); |
201 |
++ goto e_final_wa; |
202 |
++ } |
203 |
+ |
204 |
+ ret = crypto_memneq(tag.address, final_wa.address, |
205 |
+ authsize) ? -EBADMSG : 0; |
206 |
+ ccp_dm_free(&tag); |
207 |
+ } |
208 |
+ |
209 |
+-e_tag: |
210 |
++e_final_wa: |
211 |
+ ccp_dm_free(&final_wa); |
212 |
+ |
213 |
+ e_dst: |
214 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
215 |
+index 0dc60fe22aefc..8e4d863c7570b 100644 |
216 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
217 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
218 |
+@@ -664,6 +664,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) |
219 |
+ |
220 |
+ init_data.asic_id.pci_revision_id = adev->rev_id; |
221 |
+ init_data.asic_id.hw_internal_rev = adev->external_rev_id; |
222 |
++ init_data.asic_id.chip_id = adev->pdev->device; |
223 |
+ |
224 |
+ init_data.asic_id.vram_width = adev->gmc.vram_width; |
225 |
+ /* TODO: initialize init_data.asic_id.vram_type here!!!! */ |
226 |
+diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c |
227 |
+index 0790fbd3fc9a2..467d789f9bc2d 100644 |
228 |
+--- a/drivers/hid/hid-betopff.c |
229 |
++++ b/drivers/hid/hid-betopff.c |
230 |
+@@ -56,15 +56,22 @@ static int betopff_init(struct hid_device *hid) |
231 |
+ { |
232 |
+ struct betopff_device *betopff; |
233 |
+ struct hid_report *report; |
234 |
+- struct hid_input *hidinput = |
235 |
+- list_first_entry(&hid->inputs, struct hid_input, list); |
236 |
++ struct hid_input *hidinput; |
237 |
+ struct list_head *report_list = |
238 |
+ &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
239 |
+- struct input_dev *dev = hidinput->input; |
240 |
++ struct input_dev *dev; |
241 |
+ int field_count = 0; |
242 |
+ int error; |
243 |
+ int i, j; |
244 |
+ |
245 |
++ if (list_empty(&hid->inputs)) { |
246 |
++ hid_err(hid, "no inputs found\n"); |
247 |
++ return -ENODEV; |
248 |
++ } |
249 |
++ |
250 |
++ hidinput = list_first_entry(&hid->inputs, struct hid_input, list); |
251 |
++ dev = hidinput->input; |
252 |
++ |
253 |
+ if (list_empty(report_list)) { |
254 |
+ hid_err(hid, "no output reports found\n"); |
255 |
+ return -ENODEV; |
256 |
+diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c |
257 |
+index 95e0807878c7e..d70cd3d7f583b 100644 |
258 |
+--- a/drivers/hid/hid-u2fzero.c |
259 |
++++ b/drivers/hid/hid-u2fzero.c |
260 |
+@@ -198,7 +198,9 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data, |
261 |
+ } |
262 |
+ |
263 |
+ ret = u2fzero_recv(dev, &req, &resp); |
264 |
+- if (ret < 0) |
265 |
++ |
266 |
++ /* ignore errors or packets without data */ |
267 |
++ if (ret < offsetof(struct u2f_hid_msg, init.data)) |
268 |
+ return 0; |
269 |
+ |
270 |
+ /* only take the minimum amount of data it is safe to take */ |
271 |
+diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c |
272 |
+index 1cfbbaf6901da..8537fcdb456df 100644 |
273 |
+--- a/drivers/hid/usbhid/hid-core.c |
274 |
++++ b/drivers/hid/usbhid/hid-core.c |
275 |
+@@ -503,7 +503,7 @@ static void hid_ctrl(struct urb *urb) |
276 |
+ |
277 |
+ if (unplug) { |
278 |
+ usbhid->ctrltail = usbhid->ctrlhead; |
279 |
+- } else { |
280 |
++ } else if (usbhid->ctrlhead != usbhid->ctrltail) { |
281 |
+ usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); |
282 |
+ |
283 |
+ if (usbhid->ctrlhead != usbhid->ctrltail && |
284 |
+@@ -1221,9 +1221,20 @@ static void usbhid_stop(struct hid_device *hid) |
285 |
+ mutex_lock(&usbhid->mutex); |
286 |
+ |
287 |
+ clear_bit(HID_STARTED, &usbhid->iofl); |
288 |
++ |
289 |
+ spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */ |
290 |
+ set_bit(HID_DISCONNECTED, &usbhid->iofl); |
291 |
++ while (usbhid->ctrltail != usbhid->ctrlhead) { |
292 |
++ if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_OUT) { |
293 |
++ kfree(usbhid->ctrl[usbhid->ctrltail].raw_report); |
294 |
++ usbhid->ctrl[usbhid->ctrltail].raw_report = NULL; |
295 |
++ } |
296 |
++ |
297 |
++ usbhid->ctrltail = (usbhid->ctrltail + 1) & |
298 |
++ (HID_CONTROL_FIFO_SIZE - 1); |
299 |
++ } |
300 |
+ spin_unlock_irq(&usbhid->lock); |
301 |
++ |
302 |
+ usb_kill_urb(usbhid->urbin); |
303 |
+ usb_kill_urb(usbhid->urbout); |
304 |
+ usb_kill_urb(usbhid->urbctrl); |
305 |
+diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c |
306 |
+index ed8d59d4eecb3..bd8f5a3aaad9c 100644 |
307 |
+--- a/drivers/hwmon/mlxreg-fan.c |
308 |
++++ b/drivers/hwmon/mlxreg-fan.c |
309 |
+@@ -291,8 +291,8 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, |
310 |
+ { |
311 |
+ struct mlxreg_fan *fan = cdev->devdata; |
312 |
+ unsigned long cur_state; |
313 |
++ int i, config = 0; |
314 |
+ u32 regval; |
315 |
+- int i; |
316 |
+ int err; |
317 |
+ |
318 |
+ /* |
319 |
+@@ -305,6 +305,12 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, |
320 |
+ * overwritten. |
321 |
+ */ |
322 |
+ if (state >= MLXREG_FAN_SPEED_MIN && state <= MLXREG_FAN_SPEED_MAX) { |
323 |
++ /* |
324 |
++ * This is configuration change, which is only supported through sysfs. |
325 |
++ * For configuration non-zero value is to be returned to avoid thermal |
326 |
++ * statistics update. |
327 |
++ */ |
328 |
++ config = 1; |
329 |
+ state -= MLXREG_FAN_MAX_STATE; |
330 |
+ for (i = 0; i < state; i++) |
331 |
+ fan->cooling_levels[i] = state; |
332 |
+@@ -319,7 +325,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, |
333 |
+ |
334 |
+ cur_state = MLXREG_FAN_PWM_DUTY2STATE(regval); |
335 |
+ if (state < cur_state) |
336 |
+- return 0; |
337 |
++ return config; |
338 |
+ |
339 |
+ state = cur_state; |
340 |
+ } |
341 |
+@@ -335,7 +341,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, |
342 |
+ dev_err(fan->dev, "Failed to write PWM duty\n"); |
343 |
+ return err; |
344 |
+ } |
345 |
+- return 0; |
346 |
++ return config; |
347 |
+ } |
348 |
+ |
349 |
+ static const struct thermal_cooling_device_ops mlxreg_fan_cooling_ops = { |
350 |
+diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c |
351 |
+index a94e35cff3e5f..876ccf77a825a 100644 |
352 |
+--- a/drivers/hwmon/tmp421.c |
353 |
++++ b/drivers/hwmon/tmp421.c |
354 |
+@@ -100,23 +100,17 @@ struct tmp421_data { |
355 |
+ s16 temp[4]; |
356 |
+ }; |
357 |
+ |
358 |
+-static int temp_from_s16(s16 reg) |
359 |
++static int temp_from_raw(u16 reg, bool extended) |
360 |
+ { |
361 |
+ /* Mask out status bits */ |
362 |
+ int temp = reg & ~0xf; |
363 |
+ |
364 |
+- return (temp * 1000 + 128) / 256; |
365 |
+-} |
366 |
+- |
367 |
+-static int temp_from_u16(u16 reg) |
368 |
+-{ |
369 |
+- /* Mask out status bits */ |
370 |
+- int temp = reg & ~0xf; |
371 |
+- |
372 |
+- /* Add offset for extended temperature range. */ |
373 |
+- temp -= 64 * 256; |
374 |
++ if (extended) |
375 |
++ temp = temp - 64 * 256; |
376 |
++ else |
377 |
++ temp = (s16)temp; |
378 |
+ |
379 |
+- return (temp * 1000 + 128) / 256; |
380 |
++ return DIV_ROUND_CLOSEST(temp * 1000, 256); |
381 |
+ } |
382 |
+ |
383 |
+ static struct tmp421_data *tmp421_update_device(struct device *dev) |
384 |
+@@ -153,17 +147,15 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, |
385 |
+ |
386 |
+ switch (attr) { |
387 |
+ case hwmon_temp_input: |
388 |
+- if (tmp421->config & TMP421_CONFIG_RANGE) |
389 |
+- *val = temp_from_u16(tmp421->temp[channel]); |
390 |
+- else |
391 |
+- *val = temp_from_s16(tmp421->temp[channel]); |
392 |
++ *val = temp_from_raw(tmp421->temp[channel], |
393 |
++ tmp421->config & TMP421_CONFIG_RANGE); |
394 |
+ return 0; |
395 |
+ case hwmon_temp_fault: |
396 |
+ /* |
397 |
+- * The OPEN bit signals a fault. This is bit 0 of the temperature |
398 |
+- * register (low byte). |
399 |
++ * Any of OPEN or /PVLD bits indicate a hardware mulfunction |
400 |
++ * and the conversion result may be incorrect |
401 |
+ */ |
402 |
+- *val = tmp421->temp[channel] & 0x01; |
403 |
++ *val = !!(tmp421->temp[channel] & 0x03); |
404 |
+ return 0; |
405 |
+ default: |
406 |
+ return -EOPNOTSUPP; |
407 |
+@@ -176,9 +168,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, |
408 |
+ { |
409 |
+ switch (attr) { |
410 |
+ case hwmon_temp_fault: |
411 |
+- if (channel == 0) |
412 |
+- return 0; |
413 |
+- return 0444; |
414 |
+ case hwmon_temp_input: |
415 |
+ return 0444; |
416 |
+ default: |
417 |
+diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c |
418 |
+index aad8d4da5802b..b586e917e6ede 100644 |
419 |
+--- a/drivers/hwmon/w83791d.c |
420 |
++++ b/drivers/hwmon/w83791d.c |
421 |
+@@ -273,9 +273,6 @@ struct w83791d_data { |
422 |
+ char valid; /* !=0 if following fields are valid */ |
423 |
+ unsigned long last_updated; /* In jiffies */ |
424 |
+ |
425 |
+- /* array of 2 pointers to subclients */ |
426 |
+- struct i2c_client *lm75[2]; |
427 |
+- |
428 |
+ /* volts */ |
429 |
+ u8 in[NUMBER_OF_VIN]; /* Register value */ |
430 |
+ u8 in_max[NUMBER_OF_VIN]; /* Register value */ |
431 |
+@@ -1258,7 +1255,6 @@ static const struct attribute_group w83791d_group_fanpwm45 = { |
432 |
+ static int w83791d_detect_subclients(struct i2c_client *client) |
433 |
+ { |
434 |
+ struct i2c_adapter *adapter = client->adapter; |
435 |
+- struct w83791d_data *data = i2c_get_clientdata(client); |
436 |
+ int address = client->addr; |
437 |
+ int i, id; |
438 |
+ u8 val; |
439 |
+@@ -1281,22 +1277,19 @@ static int w83791d_detect_subclients(struct i2c_client *client) |
440 |
+ } |
441 |
+ |
442 |
+ val = w83791d_read(client, W83791D_REG_I2C_SUBADDR); |
443 |
+- if (!(val & 0x08)) |
444 |
+- data->lm75[0] = devm_i2c_new_dummy_device(&client->dev, adapter, |
445 |
+- 0x48 + (val & 0x7)); |
446 |
+- if (!(val & 0x80)) { |
447 |
+- if (!IS_ERR(data->lm75[0]) && |
448 |
+- ((val & 0x7) == ((val >> 4) & 0x7))) { |
449 |
+- dev_err(&client->dev, |
450 |
+- "duplicate addresses 0x%x, " |
451 |
+- "use force_subclient\n", |
452 |
+- data->lm75[0]->addr); |
453 |
+- return -ENODEV; |
454 |
+- } |
455 |
+- data->lm75[1] = devm_i2c_new_dummy_device(&client->dev, adapter, |
456 |
+- 0x48 + ((val >> 4) & 0x7)); |
457 |
++ |
458 |
++ if (!(val & 0x88) && (val & 0x7) == ((val >> 4) & 0x7)) { |
459 |
++ dev_err(&client->dev, |
460 |
++ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (val & 0x7)); |
461 |
++ return -ENODEV; |
462 |
+ } |
463 |
+ |
464 |
++ if (!(val & 0x08)) |
465 |
++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + (val & 0x7)); |
466 |
++ |
467 |
++ if (!(val & 0x80)) |
468 |
++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + ((val >> 4) & 0x7)); |
469 |
++ |
470 |
+ return 0; |
471 |
+ } |
472 |
+ |
473 |
+diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c |
474 |
+index 7fc8a1160c8f9..f91db4be2fc79 100644 |
475 |
+--- a/drivers/hwmon/w83792d.c |
476 |
++++ b/drivers/hwmon/w83792d.c |
477 |
+@@ -264,9 +264,6 @@ struct w83792d_data { |
478 |
+ char valid; /* !=0 if following fields are valid */ |
479 |
+ unsigned long last_updated; /* In jiffies */ |
480 |
+ |
481 |
+- /* array of 2 pointers to subclients */ |
482 |
+- struct i2c_client *lm75[2]; |
483 |
+- |
484 |
+ u8 in[9]; /* Register value */ |
485 |
+ u8 in_max[9]; /* Register value */ |
486 |
+ u8 in_min[9]; /* Register value */ |
487 |
+@@ -928,7 +925,6 @@ w83792d_detect_subclients(struct i2c_client *new_client) |
488 |
+ int address = new_client->addr; |
489 |
+ u8 val; |
490 |
+ struct i2c_adapter *adapter = new_client->adapter; |
491 |
+- struct w83792d_data *data = i2c_get_clientdata(new_client); |
492 |
+ |
493 |
+ id = i2c_adapter_id(adapter); |
494 |
+ if (force_subclients[0] == id && force_subclients[1] == address) { |
495 |
+@@ -947,21 +943,19 @@ w83792d_detect_subclients(struct i2c_client *new_client) |
496 |
+ } |
497 |
+ |
498 |
+ val = w83792d_read_value(new_client, W83792D_REG_I2C_SUBADDR); |
499 |
+- if (!(val & 0x08)) |
500 |
+- data->lm75[0] = devm_i2c_new_dummy_device(&new_client->dev, adapter, |
501 |
+- 0x48 + (val & 0x7)); |
502 |
+- if (!(val & 0x80)) { |
503 |
+- if (!IS_ERR(data->lm75[0]) && |
504 |
+- ((val & 0x7) == ((val >> 4) & 0x7))) { |
505 |
+- dev_err(&new_client->dev, |
506 |
+- "duplicate addresses 0x%x, use force_subclient\n", |
507 |
+- data->lm75[0]->addr); |
508 |
+- return -ENODEV; |
509 |
+- } |
510 |
+- data->lm75[1] = devm_i2c_new_dummy_device(&new_client->dev, adapter, |
511 |
+- 0x48 + ((val >> 4) & 0x7)); |
512 |
++ |
513 |
++ if (!(val & 0x88) && (val & 0x7) == ((val >> 4) & 0x7)) { |
514 |
++ dev_err(&new_client->dev, |
515 |
++ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (val & 0x7)); |
516 |
++ return -ENODEV; |
517 |
+ } |
518 |
+ |
519 |
++ if (!(val & 0x08)) |
520 |
++ devm_i2c_new_dummy_device(&new_client->dev, adapter, 0x48 + (val & 0x7)); |
521 |
++ |
522 |
++ if (!(val & 0x80)) |
523 |
++ devm_i2c_new_dummy_device(&new_client->dev, adapter, 0x48 + ((val >> 4) & 0x7)); |
524 |
++ |
525 |
+ return 0; |
526 |
+ } |
527 |
+ |
528 |
+diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c |
529 |
+index 9df48b70c70c7..640330a3a8dc4 100644 |
530 |
+--- a/drivers/hwmon/w83793.c |
531 |
++++ b/drivers/hwmon/w83793.c |
532 |
+@@ -202,7 +202,6 @@ static inline s8 TEMP_TO_REG(long val, s8 min, s8 max) |
533 |
+ } |
534 |
+ |
535 |
+ struct w83793_data { |
536 |
+- struct i2c_client *lm75[2]; |
537 |
+ struct device *hwmon_dev; |
538 |
+ struct mutex update_lock; |
539 |
+ char valid; /* !=0 if following fields are valid */ |
540 |
+@@ -1566,7 +1565,6 @@ w83793_detect_subclients(struct i2c_client *client) |
541 |
+ int address = client->addr; |
542 |
+ u8 tmp; |
543 |
+ struct i2c_adapter *adapter = client->adapter; |
544 |
+- struct w83793_data *data = i2c_get_clientdata(client); |
545 |
+ |
546 |
+ id = i2c_adapter_id(adapter); |
547 |
+ if (force_subclients[0] == id && force_subclients[1] == address) { |
548 |
+@@ -1586,21 +1584,19 @@ w83793_detect_subclients(struct i2c_client *client) |
549 |
+ } |
550 |
+ |
551 |
+ tmp = w83793_read_value(client, W83793_REG_I2C_SUBADDR); |
552 |
+- if (!(tmp & 0x08)) |
553 |
+- data->lm75[0] = devm_i2c_new_dummy_device(&client->dev, adapter, |
554 |
+- 0x48 + (tmp & 0x7)); |
555 |
+- if (!(tmp & 0x80)) { |
556 |
+- if (!IS_ERR(data->lm75[0]) |
557 |
+- && ((tmp & 0x7) == ((tmp >> 4) & 0x7))) { |
558 |
+- dev_err(&client->dev, |
559 |
+- "duplicate addresses 0x%x, " |
560 |
+- "use force_subclients\n", data->lm75[0]->addr); |
561 |
+- return -ENODEV; |
562 |
+- } |
563 |
+- data->lm75[1] = devm_i2c_new_dummy_device(&client->dev, adapter, |
564 |
+- 0x48 + ((tmp >> 4) & 0x7)); |
565 |
++ |
566 |
++ if (!(tmp & 0x88) && (tmp & 0x7) == ((tmp >> 4) & 0x7)) { |
567 |
++ dev_err(&client->dev, |
568 |
++ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (tmp & 0x7)); |
569 |
++ return -ENODEV; |
570 |
+ } |
571 |
+ |
572 |
++ if (!(tmp & 0x08)) |
573 |
++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + (tmp & 0x7)); |
574 |
++ |
575 |
++ if (!(tmp & 0x80)) |
576 |
++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + ((tmp >> 4) & 0x7)); |
577 |
++ |
578 |
+ return 0; |
579 |
+ } |
580 |
+ |
581 |
+diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c |
582 |
+index 9c2a4b5d30cfc..0f1dca623b5a1 100644 |
583 |
+--- a/drivers/ipack/devices/ipoctal.c |
584 |
++++ b/drivers/ipack/devices/ipoctal.c |
585 |
+@@ -35,6 +35,7 @@ struct ipoctal_channel { |
586 |
+ unsigned int pointer_read; |
587 |
+ unsigned int pointer_write; |
588 |
+ struct tty_port tty_port; |
589 |
++ bool tty_registered; |
590 |
+ union scc2698_channel __iomem *regs; |
591 |
+ union scc2698_block __iomem *block_regs; |
592 |
+ unsigned int board_id; |
593 |
+@@ -83,22 +84,34 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) |
594 |
+ return 0; |
595 |
+ } |
596 |
+ |
597 |
+-static int ipoctal_open(struct tty_struct *tty, struct file *file) |
598 |
++static int ipoctal_install(struct tty_driver *driver, struct tty_struct *tty) |
599 |
+ { |
600 |
+ struct ipoctal_channel *channel = dev_get_drvdata(tty->dev); |
601 |
+ struct ipoctal *ipoctal = chan_to_ipoctal(channel, tty->index); |
602 |
+- int err; |
603 |
+- |
604 |
+- tty->driver_data = channel; |
605 |
++ int res; |
606 |
+ |
607 |
+ if (!ipack_get_carrier(ipoctal->dev)) |
608 |
+ return -EBUSY; |
609 |
+ |
610 |
+- err = tty_port_open(&channel->tty_port, tty, file); |
611 |
+- if (err) |
612 |
+- ipack_put_carrier(ipoctal->dev); |
613 |
++ res = tty_standard_install(driver, tty); |
614 |
++ if (res) |
615 |
++ goto err_put_carrier; |
616 |
++ |
617 |
++ tty->driver_data = channel; |
618 |
++ |
619 |
++ return 0; |
620 |
++ |
621 |
++err_put_carrier: |
622 |
++ ipack_put_carrier(ipoctal->dev); |
623 |
++ |
624 |
++ return res; |
625 |
++} |
626 |
++ |
627 |
++static int ipoctal_open(struct tty_struct *tty, struct file *file) |
628 |
++{ |
629 |
++ struct ipoctal_channel *channel = tty->driver_data; |
630 |
+ |
631 |
+- return err; |
632 |
++ return tty_port_open(&channel->tty_port, tty, file); |
633 |
+ } |
634 |
+ |
635 |
+ static void ipoctal_reset_stats(struct ipoctal_stats *stats) |
636 |
+@@ -266,7 +279,6 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, |
637 |
+ int res; |
638 |
+ int i; |
639 |
+ struct tty_driver *tty; |
640 |
+- char name[20]; |
641 |
+ struct ipoctal_channel *channel; |
642 |
+ struct ipack_region *region; |
643 |
+ void __iomem *addr; |
644 |
+@@ -357,8 +369,11 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, |
645 |
+ /* Fill struct tty_driver with ipoctal data */ |
646 |
+ tty->owner = THIS_MODULE; |
647 |
+ tty->driver_name = KBUILD_MODNAME; |
648 |
+- sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); |
649 |
+- tty->name = name; |
650 |
++ tty->name = kasprintf(GFP_KERNEL, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); |
651 |
++ if (!tty->name) { |
652 |
++ res = -ENOMEM; |
653 |
++ goto err_put_driver; |
654 |
++ } |
655 |
+ tty->major = 0; |
656 |
+ |
657 |
+ tty->minor_start = 0; |
658 |
+@@ -374,8 +389,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, |
659 |
+ res = tty_register_driver(tty); |
660 |
+ if (res) { |
661 |
+ dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n"); |
662 |
+- put_tty_driver(tty); |
663 |
+- return res; |
664 |
++ goto err_free_name; |
665 |
+ } |
666 |
+ |
667 |
+ /* Save struct tty_driver for use it when uninstalling the device */ |
668 |
+@@ -386,7 +400,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, |
669 |
+ |
670 |
+ channel = &ipoctal->channel[i]; |
671 |
+ tty_port_init(&channel->tty_port); |
672 |
+- tty_port_alloc_xmit_buf(&channel->tty_port); |
673 |
++ res = tty_port_alloc_xmit_buf(&channel->tty_port); |
674 |
++ if (res) |
675 |
++ continue; |
676 |
+ channel->tty_port.ops = &ipoctal_tty_port_ops; |
677 |
+ |
678 |
+ ipoctal_reset_stats(&channel->stats); |
679 |
+@@ -394,13 +410,15 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, |
680 |
+ spin_lock_init(&channel->lock); |
681 |
+ channel->pointer_read = 0; |
682 |
+ channel->pointer_write = 0; |
683 |
+- tty_dev = tty_port_register_device(&channel->tty_port, tty, i, NULL); |
684 |
++ tty_dev = tty_port_register_device_attr(&channel->tty_port, tty, |
685 |
++ i, NULL, channel, NULL); |
686 |
+ if (IS_ERR(tty_dev)) { |
687 |
+ dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n"); |
688 |
++ tty_port_free_xmit_buf(&channel->tty_port); |
689 |
+ tty_port_destroy(&channel->tty_port); |
690 |
+ continue; |
691 |
+ } |
692 |
+- dev_set_drvdata(tty_dev, channel); |
693 |
++ channel->tty_registered = true; |
694 |
+ } |
695 |
+ |
696 |
+ /* |
697 |
+@@ -412,6 +430,13 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, |
698 |
+ ipoctal_irq_handler, ipoctal); |
699 |
+ |
700 |
+ return 0; |
701 |
++ |
702 |
++err_free_name: |
703 |
++ kfree(tty->name); |
704 |
++err_put_driver: |
705 |
++ put_tty_driver(tty); |
706 |
++ |
707 |
++ return res; |
708 |
+ } |
709 |
+ |
710 |
+ static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, |
711 |
+@@ -652,6 +677,7 @@ static void ipoctal_cleanup(struct tty_struct *tty) |
712 |
+ |
713 |
+ static const struct tty_operations ipoctal_fops = { |
714 |
+ .ioctl = NULL, |
715 |
++ .install = ipoctal_install, |
716 |
+ .open = ipoctal_open, |
717 |
+ .close = ipoctal_close, |
718 |
+ .write = ipoctal_write_tty, |
719 |
+@@ -694,12 +720,17 @@ static void __ipoctal_remove(struct ipoctal *ipoctal) |
720 |
+ |
721 |
+ for (i = 0; i < NR_CHANNELS; i++) { |
722 |
+ struct ipoctal_channel *channel = &ipoctal->channel[i]; |
723 |
++ |
724 |
++ if (!channel->tty_registered) |
725 |
++ continue; |
726 |
++ |
727 |
+ tty_unregister_device(ipoctal->tty_drv, i); |
728 |
+ tty_port_free_xmit_buf(&channel->tty_port); |
729 |
+ tty_port_destroy(&channel->tty_port); |
730 |
+ } |
731 |
+ |
732 |
+ tty_unregister_driver(ipoctal->tty_drv); |
733 |
++ kfree(ipoctal->tty_drv->name); |
734 |
+ put_tty_driver(ipoctal->tty_drv); |
735 |
+ kfree(ipoctal); |
736 |
+ } |
737 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
738 |
+index db9c8f943811b..ffd1018d43fbe 100644 |
739 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
740 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |
741 |
+@@ -452,6 +452,11 @@ static int hns3_nic_net_open(struct net_device *netdev) |
742 |
+ if (hns3_nic_resetting(netdev)) |
743 |
+ return -EBUSY; |
744 |
+ |
745 |
++ if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) { |
746 |
++ netdev_warn(netdev, "net open repeatedly!\n"); |
747 |
++ return 0; |
748 |
++ } |
749 |
++ |
750 |
+ netif_carrier_off(netdev); |
751 |
+ |
752 |
+ ret = hns3_nic_set_real_num_queue(netdev); |
753 |
+diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c |
754 |
+index 911b3d2a94e1c..70962967d7141 100644 |
755 |
+--- a/drivers/net/ethernet/intel/e100.c |
756 |
++++ b/drivers/net/ethernet/intel/e100.c |
757 |
+@@ -2435,11 +2435,15 @@ static void e100_get_drvinfo(struct net_device *netdev, |
758 |
+ sizeof(info->bus_info)); |
759 |
+ } |
760 |
+ |
761 |
+-#define E100_PHY_REGS 0x1C |
762 |
++#define E100_PHY_REGS 0x1D |
763 |
+ static int e100_get_regs_len(struct net_device *netdev) |
764 |
+ { |
765 |
+ struct nic *nic = netdev_priv(netdev); |
766 |
+- return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf); |
767 |
++ |
768 |
++ /* We know the number of registers, and the size of the dump buffer. |
769 |
++ * Calculate the total size in bytes. |
770 |
++ */ |
771 |
++ return (1 + E100_PHY_REGS) * sizeof(u32) + sizeof(nic->mem->dump_buf); |
772 |
+ } |
773 |
+ |
774 |
+ static void e100_get_regs(struct net_device *netdev, |
775 |
+@@ -2453,14 +2457,18 @@ static void e100_get_regs(struct net_device *netdev, |
776 |
+ buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 | |
777 |
+ ioread8(&nic->csr->scb.cmd_lo) << 16 | |
778 |
+ ioread16(&nic->csr->scb.status); |
779 |
+- for (i = E100_PHY_REGS; i >= 0; i--) |
780 |
+- buff[1 + E100_PHY_REGS - i] = |
781 |
+- mdio_read(netdev, nic->mii.phy_id, i); |
782 |
++ for (i = 0; i < E100_PHY_REGS; i++) |
783 |
++ /* Note that we read the registers in reverse order. This |
784 |
++ * ordering is the ABI apparently used by ethtool and other |
785 |
++ * applications. |
786 |
++ */ |
787 |
++ buff[1 + i] = mdio_read(netdev, nic->mii.phy_id, |
788 |
++ E100_PHY_REGS - 1 - i); |
789 |
+ memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf)); |
790 |
+ e100_exec_cb(nic, NULL, e100_dump); |
791 |
+ msleep(10); |
792 |
+- memcpy(&buff[2 + E100_PHY_REGS], nic->mem->dump_buf, |
793 |
+- sizeof(nic->mem->dump_buf)); |
794 |
++ memcpy(&buff[1 + E100_PHY_REGS], nic->mem->dump_buf, |
795 |
++ sizeof(nic->mem->dump_buf)); |
796 |
+ } |
797 |
+ |
798 |
+ static void e100_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
799 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
800 |
+index e09851c7da9b8..835ac178bc8c0 100644 |
801 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
802 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
803 |
+@@ -4855,8 +4855,6 @@ int stmmac_resume(struct device *dev) |
804 |
+ stmmac_mdio_reset(priv->mii); |
805 |
+ } |
806 |
+ |
807 |
+- netif_device_attach(ndev); |
808 |
+- |
809 |
+ mutex_lock(&priv->lock); |
810 |
+ |
811 |
+ stmmac_reset_queues_param(priv); |
812 |
+@@ -4880,6 +4878,8 @@ int stmmac_resume(struct device *dev) |
813 |
+ |
814 |
+ phylink_mac_change(priv->phylink, true); |
815 |
+ |
816 |
++ netif_device_attach(ndev); |
817 |
++ |
818 |
+ return 0; |
819 |
+ } |
820 |
+ EXPORT_SYMBOL_GPL(stmmac_resume); |
821 |
+diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c |
822 |
+index 9ad1f093c4ae1..31200275a0640 100644 |
823 |
+--- a/drivers/net/usb/hso.c |
824 |
++++ b/drivers/net/usb/hso.c |
825 |
+@@ -2497,7 +2497,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, |
826 |
+ hso_net_init); |
827 |
+ if (!net) { |
828 |
+ dev_err(&interface->dev, "Unable to create ethernet device\n"); |
829 |
+- goto exit; |
830 |
++ goto err_hso_dev; |
831 |
+ } |
832 |
+ |
833 |
+ hso_net = netdev_priv(net); |
834 |
+@@ -2510,13 +2510,13 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, |
835 |
+ USB_DIR_IN); |
836 |
+ if (!hso_net->in_endp) { |
837 |
+ dev_err(&interface->dev, "Can't find BULK IN endpoint\n"); |
838 |
+- goto exit; |
839 |
++ goto err_net; |
840 |
+ } |
841 |
+ hso_net->out_endp = hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, |
842 |
+ USB_DIR_OUT); |
843 |
+ if (!hso_net->out_endp) { |
844 |
+ dev_err(&interface->dev, "Can't find BULK OUT endpoint\n"); |
845 |
+- goto exit; |
846 |
++ goto err_net; |
847 |
+ } |
848 |
+ SET_NETDEV_DEV(net, &interface->dev); |
849 |
+ SET_NETDEV_DEVTYPE(net, &hso_type); |
850 |
+@@ -2525,18 +2525,18 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, |
851 |
+ for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) { |
852 |
+ hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL); |
853 |
+ if (!hso_net->mux_bulk_rx_urb_pool[i]) |
854 |
+- goto exit; |
855 |
++ goto err_mux_bulk_rx; |
856 |
+ hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE, |
857 |
+ GFP_KERNEL); |
858 |
+ if (!hso_net->mux_bulk_rx_buf_pool[i]) |
859 |
+- goto exit; |
860 |
++ goto err_mux_bulk_rx; |
861 |
+ } |
862 |
+ hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL); |
863 |
+ if (!hso_net->mux_bulk_tx_urb) |
864 |
+- goto exit; |
865 |
++ goto err_mux_bulk_rx; |
866 |
+ hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL); |
867 |
+ if (!hso_net->mux_bulk_tx_buf) |
868 |
+- goto exit; |
869 |
++ goto err_free_tx_urb; |
870 |
+ |
871 |
+ add_net_device(hso_dev); |
872 |
+ |
873 |
+@@ -2544,7 +2544,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, |
874 |
+ result = register_netdev(net); |
875 |
+ if (result) { |
876 |
+ dev_err(&interface->dev, "Failed to register device\n"); |
877 |
+- goto exit; |
878 |
++ goto err_free_tx_buf; |
879 |
+ } |
880 |
+ |
881 |
+ hso_log_port(hso_dev); |
882 |
+@@ -2552,8 +2552,21 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, |
883 |
+ hso_create_rfkill(hso_dev, interface); |
884 |
+ |
885 |
+ return hso_dev; |
886 |
+-exit: |
887 |
+- hso_free_net_device(hso_dev); |
888 |
++ |
889 |
++err_free_tx_buf: |
890 |
++ remove_net_device(hso_dev); |
891 |
++ kfree(hso_net->mux_bulk_tx_buf); |
892 |
++err_free_tx_urb: |
893 |
++ usb_free_urb(hso_net->mux_bulk_tx_urb); |
894 |
++err_mux_bulk_rx: |
895 |
++ for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) { |
896 |
++ usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]); |
897 |
++ kfree(hso_net->mux_bulk_rx_buf_pool[i]); |
898 |
++ } |
899 |
++err_net: |
900 |
++ free_netdev(net); |
901 |
++err_hso_dev: |
902 |
++ kfree(hso_dev); |
903 |
+ return NULL; |
904 |
+ } |
905 |
+ |
906 |
+diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c |
907 |
+index 1033513d3d9de..07b070b14d75d 100644 |
908 |
+--- a/drivers/net/wireless/mac80211_hwsim.c |
909 |
++++ b/drivers/net/wireless/mac80211_hwsim.c |
910 |
+@@ -1603,8 +1603,8 @@ mac80211_hwsim_beacon(struct hrtimer *timer) |
911 |
+ bcn_int -= data->bcn_delta; |
912 |
+ data->bcn_delta = 0; |
913 |
+ } |
914 |
+- hrtimer_forward(&data->beacon_timer, hrtimer_get_expires(timer), |
915 |
+- ns_to_ktime(bcn_int * NSEC_PER_USEC)); |
916 |
++ hrtimer_forward_now(&data->beacon_timer, |
917 |
++ ns_to_ktime(bcn_int * NSEC_PER_USEC)); |
918 |
+ return HRTIMER_RESTART; |
919 |
+ } |
920 |
+ |
921 |
+diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c |
922 |
+index f9f76f6ba07b1..7e65306b2bf24 100644 |
923 |
+--- a/drivers/nvdimm/pmem.c |
924 |
++++ b/drivers/nvdimm/pmem.c |
925 |
+@@ -423,11 +423,11 @@ static int pmem_attach_disk(struct device *dev, |
926 |
+ pmem->pfn_flags |= PFN_MAP; |
927 |
+ memcpy(&bb_res, &pmem->pgmap.res, sizeof(bb_res)); |
928 |
+ } else { |
929 |
++ addr = devm_memremap(dev, pmem->phys_addr, |
930 |
++ pmem->size, ARCH_MEMREMAP_PMEM); |
931 |
+ if (devm_add_action_or_reset(dev, pmem_release_queue, |
932 |
+ &pmem->pgmap)) |
933 |
+ return -ENOMEM; |
934 |
+- addr = devm_memremap(dev, pmem->phys_addr, |
935 |
+- pmem->size, ARCH_MEMREMAP_PMEM); |
936 |
+ memcpy(&bb_res, &nsio->res, sizeof(bb_res)); |
937 |
+ } |
938 |
+ |
939 |
+diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
940 |
+index f28213b625279..a41d04c57642d 100644 |
941 |
+--- a/drivers/pci/probe.c |
942 |
++++ b/drivers/pci/probe.c |
943 |
+@@ -564,7 +564,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent) |
944 |
+ return b; |
945 |
+ } |
946 |
+ |
947 |
+-static void devm_pci_release_host_bridge_dev(struct device *dev) |
948 |
++static void pci_release_host_bridge_dev(struct device *dev) |
949 |
+ { |
950 |
+ struct pci_host_bridge *bridge = to_pci_host_bridge(dev); |
951 |
+ |
952 |
+@@ -573,12 +573,7 @@ static void devm_pci_release_host_bridge_dev(struct device *dev) |
953 |
+ |
954 |
+ pci_free_resource_list(&bridge->windows); |
955 |
+ pci_free_resource_list(&bridge->dma_ranges); |
956 |
+-} |
957 |
+- |
958 |
+-static void pci_release_host_bridge_dev(struct device *dev) |
959 |
+-{ |
960 |
+- devm_pci_release_host_bridge_dev(dev); |
961 |
+- kfree(to_pci_host_bridge(dev)); |
962 |
++ kfree(bridge); |
963 |
+ } |
964 |
+ |
965 |
+ static void pci_init_host_bridge(struct pci_host_bridge *bridge) |
966 |
+@@ -597,6 +592,8 @@ static void pci_init_host_bridge(struct pci_host_bridge *bridge) |
967 |
+ bridge->native_shpc_hotplug = 1; |
968 |
+ bridge->native_pme = 1; |
969 |
+ bridge->native_ltr = 1; |
970 |
++ |
971 |
++ device_initialize(&bridge->dev); |
972 |
+ } |
973 |
+ |
974 |
+ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) |
975 |
+@@ -614,17 +611,25 @@ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) |
976 |
+ } |
977 |
+ EXPORT_SYMBOL(pci_alloc_host_bridge); |
978 |
+ |
979 |
++static void devm_pci_alloc_host_bridge_release(void *data) |
980 |
++{ |
981 |
++ pci_free_host_bridge(data); |
982 |
++} |
983 |
++ |
984 |
+ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev, |
985 |
+ size_t priv) |
986 |
+ { |
987 |
++ int ret; |
988 |
+ struct pci_host_bridge *bridge; |
989 |
+ |
990 |
+- bridge = devm_kzalloc(dev, sizeof(*bridge) + priv, GFP_KERNEL); |
991 |
++ bridge = pci_alloc_host_bridge(priv); |
992 |
+ if (!bridge) |
993 |
+ return NULL; |
994 |
+ |
995 |
+- pci_init_host_bridge(bridge); |
996 |
+- bridge->dev.release = devm_pci_release_host_bridge_dev; |
997 |
++ ret = devm_add_action_or_reset(dev, devm_pci_alloc_host_bridge_release, |
998 |
++ bridge); |
999 |
++ if (ret) |
1000 |
++ return NULL; |
1001 |
+ |
1002 |
+ return bridge; |
1003 |
+ } |
1004 |
+@@ -632,10 +637,7 @@ EXPORT_SYMBOL(devm_pci_alloc_host_bridge); |
1005 |
+ |
1006 |
+ void pci_free_host_bridge(struct pci_host_bridge *bridge) |
1007 |
+ { |
1008 |
+- pci_free_resource_list(&bridge->windows); |
1009 |
+- pci_free_resource_list(&bridge->dma_ranges); |
1010 |
+- |
1011 |
+- kfree(bridge); |
1012 |
++ put_device(&bridge->dev); |
1013 |
+ } |
1014 |
+ EXPORT_SYMBOL(pci_free_host_bridge); |
1015 |
+ |
1016 |
+@@ -866,7 +868,7 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
1017 |
+ if (err) |
1018 |
+ goto free; |
1019 |
+ |
1020 |
+- err = device_register(&bridge->dev); |
1021 |
++ err = device_add(&bridge->dev); |
1022 |
+ if (err) { |
1023 |
+ put_device(&bridge->dev); |
1024 |
+ goto free; |
1025 |
+@@ -933,7 +935,7 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) |
1026 |
+ |
1027 |
+ unregister: |
1028 |
+ put_device(&bridge->dev); |
1029 |
+- device_unregister(&bridge->dev); |
1030 |
++ device_del(&bridge->dev); |
1031 |
+ |
1032 |
+ free: |
1033 |
+ kfree(bus); |
1034 |
+@@ -2945,7 +2947,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, |
1035 |
+ return bridge->bus; |
1036 |
+ |
1037 |
+ err_out: |
1038 |
+- kfree(bridge); |
1039 |
++ put_device(&bridge->dev); |
1040 |
+ return NULL; |
1041 |
+ } |
1042 |
+ EXPORT_SYMBOL_GPL(pci_create_root_bus); |
1043 |
+diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c |
1044 |
+index e9c6b120cf451..95dec03d9f2a9 100644 |
1045 |
+--- a/drivers/pci/remove.c |
1046 |
++++ b/drivers/pci/remove.c |
1047 |
+@@ -160,6 +160,6 @@ void pci_remove_root_bus(struct pci_bus *bus) |
1048 |
+ host_bridge->bus = NULL; |
1049 |
+ |
1050 |
+ /* remove the host bridge */ |
1051 |
+- device_unregister(&host_bridge->dev); |
1052 |
++ device_del(&host_bridge->dev); |
1053 |
+ } |
1054 |
+ EXPORT_SYMBOL_GPL(pci_remove_root_bus); |
1055 |
+diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c |
1056 |
+index a6dd704d7f2de..1b8ccadc7cf67 100644 |
1057 |
+--- a/drivers/scsi/csiostor/csio_init.c |
1058 |
++++ b/drivers/scsi/csiostor/csio_init.c |
1059 |
+@@ -1257,3 +1257,4 @@ MODULE_DEVICE_TABLE(pci, csio_pci_tbl); |
1060 |
+ MODULE_VERSION(CSIO_DRV_VERSION); |
1061 |
+ MODULE_FIRMWARE(FW_FNAME_T5); |
1062 |
+ MODULE_FIRMWARE(FW_FNAME_T6); |
1063 |
++MODULE_SOFTDEP("pre: cxgb4"); |
1064 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
1065 |
+index 0429ba5d7d23c..24396f4d5f2d3 100644 |
1066 |
+--- a/drivers/scsi/ufs/ufshcd.c |
1067 |
++++ b/drivers/scsi/ufs/ufshcd.c |
1068 |
+@@ -320,8 +320,7 @@ static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag, |
1069 |
+ static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag, |
1070 |
+ const char *str) |
1071 |
+ { |
1072 |
+- int off = (int)tag - hba->nutrs; |
1073 |
+- struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off]; |
1074 |
++ struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[tag]; |
1075 |
+ |
1076 |
+ trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header, |
1077 |
+ &descp->input_param1); |
1078 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
1079 |
+index 404b80dc06b87..d1ab8561e2581 100644 |
1080 |
+--- a/drivers/tty/vt/vt.c |
1081 |
++++ b/drivers/tty/vt/vt.c |
1082 |
+@@ -1215,8 +1215,25 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, |
1083 |
+ new_row_size = new_cols << 1; |
1084 |
+ new_screen_size = new_row_size * new_rows; |
1085 |
+ |
1086 |
+- if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) |
1087 |
+- return 0; |
1088 |
++ if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) { |
1089 |
++ /* |
1090 |
++ * This function is being called here to cover the case |
1091 |
++ * where the userspace calls the FBIOPUT_VSCREENINFO twice, |
1092 |
++ * passing the same fb_var_screeninfo containing the fields |
1093 |
++ * yres/xres equal to a number non-multiple of vc_font.height |
1094 |
++ * and yres_virtual/xres_virtual equal to number lesser than the |
1095 |
++ * vc_font.height and yres/xres. |
1096 |
++ * In the second call, the struct fb_var_screeninfo isn't |
1097 |
++ * being modified by the underlying driver because of the |
1098 |
++ * if above, and this causes the fbcon_display->vrows to become |
1099 |
++ * negative and it eventually leads to out-of-bound |
1100 |
++ * access by the imageblit function. |
1101 |
++ * To give the correct values to the struct and to not have |
1102 |
++ * to deal with possible errors from the code below, we call |
1103 |
++ * the resize_screen here as well. |
1104 |
++ */ |
1105 |
++ return resize_screen(vc, new_cols, new_rows, user); |
1106 |
++ } |
1107 |
+ |
1108 |
+ if (new_screen_size > KMALLOC_MAX_SIZE || !new_screen_size) |
1109 |
+ return -EINVAL; |
1110 |
+diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c |
1111 |
+index c3bf54cc530f9..296f2ee1b6803 100644 |
1112 |
+--- a/drivers/usb/cdns3/gadget.c |
1113 |
++++ b/drivers/usb/cdns3/gadget.c |
1114 |
+@@ -807,6 +807,19 @@ static void cdns3_wa1_tray_restore_cycle_bit(struct cdns3_device *priv_dev, |
1115 |
+ cdns3_wa1_restore_cycle_bit(priv_ep); |
1116 |
+ } |
1117 |
+ |
1118 |
++static void cdns3_rearm_drdy_if_needed(struct cdns3_endpoint *priv_ep) |
1119 |
++{ |
1120 |
++ struct cdns3_device *priv_dev = priv_ep->cdns3_dev; |
1121 |
++ |
1122 |
++ if (priv_dev->dev_ver < DEV_VER_V3) |
1123 |
++ return; |
1124 |
++ |
1125 |
++ if (readl(&priv_dev->regs->ep_sts) & EP_STS_TRBERR) { |
1126 |
++ writel(EP_STS_TRBERR, &priv_dev->regs->ep_sts); |
1127 |
++ writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); |
1128 |
++ } |
1129 |
++} |
1130 |
++ |
1131 |
+ /** |
1132 |
+ * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware |
1133 |
+ * @priv_ep: endpoint object |
1134 |
+@@ -1003,6 +1016,7 @@ int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, |
1135 |
+ /*clearing TRBERR and EP_STS_DESCMIS before seting DRDY*/ |
1136 |
+ writel(EP_STS_TRBERR | EP_STS_DESCMIS, &priv_dev->regs->ep_sts); |
1137 |
+ writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); |
1138 |
++ cdns3_rearm_drdy_if_needed(priv_ep); |
1139 |
+ trace_cdns3_doorbell_epx(priv_ep->name, |
1140 |
+ readl(&priv_dev->regs->ep_traddr)); |
1141 |
+ } |
1142 |
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c |
1143 |
+index 7ce3cfd965d25..72cd871544ac0 100644 |
1144 |
+--- a/fs/binfmt_elf.c |
1145 |
++++ b/fs/binfmt_elf.c |
1146 |
+@@ -583,7 +583,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, |
1147 |
+ |
1148 |
+ vaddr = eppnt->p_vaddr; |
1149 |
+ if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) |
1150 |
+- elf_type |= MAP_FIXED_NOREPLACE; |
1151 |
++ elf_type |= MAP_FIXED; |
1152 |
+ else if (no_base && interp_elf_ex->e_type == ET_DYN) |
1153 |
+ load_addr = -vaddr; |
1154 |
+ |
1155 |
+diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c |
1156 |
+index 1c74a7cbf5b19..e595a29bf46e3 100644 |
1157 |
+--- a/fs/debugfs/inode.c |
1158 |
++++ b/fs/debugfs/inode.c |
1159 |
+@@ -522,7 +522,7 @@ struct dentry *debugfs_create_file_size(const char *name, umode_t mode, |
1160 |
+ { |
1161 |
+ struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); |
1162 |
+ |
1163 |
+- if (de) |
1164 |
++ if (!IS_ERR(de)) |
1165 |
+ d_inode(de)->i_size = file_size; |
1166 |
+ return de; |
1167 |
+ } |
1168 |
+diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c |
1169 |
+index 0589e914663fb..e8275b5d27439 100644 |
1170 |
+--- a/fs/ext4/dir.c |
1171 |
++++ b/fs/ext4/dir.c |
1172 |
+@@ -536,7 +536,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) |
1173 |
+ struct dir_private_info *info = file->private_data; |
1174 |
+ struct inode *inode = file_inode(file); |
1175 |
+ struct fname *fname; |
1176 |
+- int ret; |
1177 |
++ int ret = 0; |
1178 |
+ |
1179 |
+ if (!info) { |
1180 |
+ info = ext4_htree_create_dir_info(file, ctx->pos); |
1181 |
+@@ -584,7 +584,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) |
1182 |
+ info->curr_minor_hash, |
1183 |
+ &info->next_hash); |
1184 |
+ if (ret < 0) |
1185 |
+- return ret; |
1186 |
++ goto finished; |
1187 |
+ if (ret == 0) { |
1188 |
+ ctx->pos = ext4_get_htree_eof(file); |
1189 |
+ break; |
1190 |
+@@ -615,7 +615,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) |
1191 |
+ } |
1192 |
+ finished: |
1193 |
+ info->last_pos = ctx->pos; |
1194 |
+- return 0; |
1195 |
++ return ret < 0 ? ret : 0; |
1196 |
+ } |
1197 |
+ |
1198 |
+ static int ext4_dir_open(struct inode * inode, struct file * filp) |
1199 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
1200 |
+index 1429d01d836bb..48b467353f6f1 100644 |
1201 |
+--- a/fs/ext4/inode.c |
1202 |
++++ b/fs/ext4/inode.c |
1203 |
+@@ -1782,6 +1782,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) |
1204 |
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
1205 |
+ int ret; |
1206 |
+ bool allocated = false; |
1207 |
++ bool reserved = false; |
1208 |
+ |
1209 |
+ /* |
1210 |
+ * If the cluster containing lblk is shared with a delayed, |
1211 |
+@@ -1798,6 +1799,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) |
1212 |
+ ret = ext4_da_reserve_space(inode); |
1213 |
+ if (ret != 0) /* ENOSPC */ |
1214 |
+ goto errout; |
1215 |
++ reserved = true; |
1216 |
+ } else { /* bigalloc */ |
1217 |
+ if (!ext4_es_scan_clu(inode, &ext4_es_is_delonly, lblk)) { |
1218 |
+ if (!ext4_es_scan_clu(inode, |
1219 |
+@@ -1810,6 +1812,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) |
1220 |
+ ret = ext4_da_reserve_space(inode); |
1221 |
+ if (ret != 0) /* ENOSPC */ |
1222 |
+ goto errout; |
1223 |
++ reserved = true; |
1224 |
+ } else { |
1225 |
+ allocated = true; |
1226 |
+ } |
1227 |
+@@ -1820,6 +1823,8 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) |
1228 |
+ } |
1229 |
+ |
1230 |
+ ret = ext4_es_insert_delayed_block(inode, lblk, allocated); |
1231 |
++ if (ret && reserved) |
1232 |
++ ext4_da_release_space(inode, 1); |
1233 |
+ |
1234 |
+ errout: |
1235 |
+ return ret; |
1236 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
1237 |
+index ce8372ceaa43e..1211ae203face 100644 |
1238 |
+--- a/fs/ext4/super.c |
1239 |
++++ b/fs/ext4/super.c |
1240 |
+@@ -1141,6 +1141,12 @@ static void ext4_destroy_inode(struct inode *inode) |
1241 |
+ true); |
1242 |
+ dump_stack(); |
1243 |
+ } |
1244 |
++ |
1245 |
++ if (EXT4_I(inode)->i_reserved_data_blocks) |
1246 |
++ ext4_msg(inode->i_sb, KERN_ERR, |
1247 |
++ "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", |
1248 |
++ inode->i_ino, EXT4_I(inode), |
1249 |
++ EXT4_I(inode)->i_reserved_data_blocks); |
1250 |
+ } |
1251 |
+ |
1252 |
+ static void init_once(void *foo) |
1253 |
+@@ -2830,17 +2836,17 @@ static loff_t ext4_max_size(int blkbits, int has_huge_files) |
1254 |
+ */ |
1255 |
+ static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) |
1256 |
+ { |
1257 |
+- loff_t res = EXT4_NDIR_BLOCKS; |
1258 |
++ unsigned long long upper_limit, res = EXT4_NDIR_BLOCKS; |
1259 |
+ int meta_blocks; |
1260 |
+- loff_t upper_limit; |
1261 |
+- /* This is calculated to be the largest file size for a dense, block |
1262 |
++ |
1263 |
++ /* |
1264 |
++ * This is calculated to be the largest file size for a dense, block |
1265 |
+ * mapped file such that the file's total number of 512-byte sectors, |
1266 |
+ * including data and all indirect blocks, does not exceed (2^48 - 1). |
1267 |
+ * |
1268 |
+ * __u32 i_blocks_lo and _u16 i_blocks_high represent the total |
1269 |
+ * number of 512-byte sectors of the file. |
1270 |
+ */ |
1271 |
+- |
1272 |
+ if (!has_huge_files) { |
1273 |
+ /* |
1274 |
+ * !has_huge_files or implies that the inode i_block field |
1275 |
+@@ -2883,7 +2889,7 @@ static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) |
1276 |
+ if (res > MAX_LFS_FILESIZE) |
1277 |
+ res = MAX_LFS_FILESIZE; |
1278 |
+ |
1279 |
+- return res; |
1280 |
++ return (loff_t)res; |
1281 |
+ } |
1282 |
+ |
1283 |
+ static ext4_fsblk_t descriptor_loc(struct super_block *sb, |
1284 |
+diff --git a/fs/verity/enable.c b/fs/verity/enable.c |
1285 |
+index eabc6ac199064..1370bfd17e870 100644 |
1286 |
+--- a/fs/verity/enable.c |
1287 |
++++ b/fs/verity/enable.c |
1288 |
+@@ -136,7 +136,7 @@ static int build_merkle_tree(struct inode *inode, |
1289 |
+ * (level 0) and ascending to the root node (level 'num_levels - 1'). |
1290 |
+ * Then at the end (level 'num_levels'), calculate the root hash. |
1291 |
+ */ |
1292 |
+- blocks = (inode->i_size + params->block_size - 1) >> |
1293 |
++ blocks = ((u64)inode->i_size + params->block_size - 1) >> |
1294 |
+ params->log_blocksize; |
1295 |
+ for (level = 0; level <= params->num_levels; level++) { |
1296 |
+ err = build_merkle_tree_level(inode, level, blocks, params, |
1297 |
+diff --git a/fs/verity/open.c b/fs/verity/open.c |
1298 |
+index 63d1004b688cb..6200826107c24 100644 |
1299 |
+--- a/fs/verity/open.c |
1300 |
++++ b/fs/verity/open.c |
1301 |
+@@ -89,7 +89,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params, |
1302 |
+ */ |
1303 |
+ |
1304 |
+ /* Compute number of levels and the number of blocks in each level */ |
1305 |
+- blocks = (inode->i_size + params->block_size - 1) >> log_blocksize; |
1306 |
++ blocks = ((u64)inode->i_size + params->block_size - 1) >> log_blocksize; |
1307 |
+ pr_debug("Data is %lld bytes (%llu blocks)\n", inode->i_size, blocks); |
1308 |
+ while (blocks > 1) { |
1309 |
+ if (params->num_levels >= FS_VERITY_MAX_LEVELS) { |
1310 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
1311 |
+index ffbae7683450a..cb6c125628990 100644 |
1312 |
+--- a/include/net/ip_fib.h |
1313 |
++++ b/include/net/ip_fib.h |
1314 |
+@@ -524,5 +524,5 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, |
1315 |
+ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh, |
1316 |
+ u8 rt_family, unsigned char *flags, bool skip_oif); |
1317 |
+ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nh, |
1318 |
+- int nh_weight, u8 rt_family); |
1319 |
++ int nh_weight, u8 rt_family, u32 nh_tclassid); |
1320 |
+ #endif /* _NET_FIB_H */ |
1321 |
+diff --git a/include/net/nexthop.h b/include/net/nexthop.h |
1322 |
+index 18a5aca264767..5ad614793af26 100644 |
1323 |
+--- a/include/net/nexthop.h |
1324 |
++++ b/include/net/nexthop.h |
1325 |
+@@ -173,7 +173,7 @@ int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh, |
1326 |
+ struct fib_nh_common *nhc = &nhi->fib_nhc; |
1327 |
+ int weight = nhg->nh_entries[i].weight; |
1328 |
+ |
1329 |
+- if (fib_add_nexthop(skb, nhc, weight, rt_family) < 0) |
1330 |
++ if (fib_add_nexthop(skb, nhc, weight, rt_family, 0) < 0) |
1331 |
+ return -EMSGSIZE; |
1332 |
+ } |
1333 |
+ |
1334 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
1335 |
+index d3dd89b6e2cba..079b5f6f13d81 100644 |
1336 |
+--- a/include/net/sock.h |
1337 |
++++ b/include/net/sock.h |
1338 |
+@@ -470,8 +470,10 @@ struct sock { |
1339 |
+ u32 sk_ack_backlog; |
1340 |
+ u32 sk_max_ack_backlog; |
1341 |
+ kuid_t sk_uid; |
1342 |
++ spinlock_t sk_peer_lock; |
1343 |
+ struct pid *sk_peer_pid; |
1344 |
+ const struct cred *sk_peer_cred; |
1345 |
++ |
1346 |
+ long sk_rcvtimeo; |
1347 |
+ ktime_t sk_stamp; |
1348 |
+ #if BITS_PER_LONG==32 |
1349 |
+diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c |
1350 |
+index 4cb80e6042c4f..831fee509404e 100644 |
1351 |
+--- a/kernel/sched/cpufreq_schedutil.c |
1352 |
++++ b/kernel/sched/cpufreq_schedutil.c |
1353 |
+@@ -624,9 +624,17 @@ static struct attribute *sugov_attrs[] = { |
1354 |
+ }; |
1355 |
+ ATTRIBUTE_GROUPS(sugov); |
1356 |
+ |
1357 |
++static void sugov_tunables_free(struct kobject *kobj) |
1358 |
++{ |
1359 |
++ struct gov_attr_set *attr_set = container_of(kobj, struct gov_attr_set, kobj); |
1360 |
++ |
1361 |
++ kfree(to_sugov_tunables(attr_set)); |
1362 |
++} |
1363 |
++ |
1364 |
+ static struct kobj_type sugov_tunables_ktype = { |
1365 |
+ .default_groups = sugov_groups, |
1366 |
+ .sysfs_ops = &governor_sysfs_ops, |
1367 |
++ .release = &sugov_tunables_free, |
1368 |
+ }; |
1369 |
+ |
1370 |
+ /********************** cpufreq governor interface *********************/ |
1371 |
+@@ -726,12 +734,10 @@ static struct sugov_tunables *sugov_tunables_alloc(struct sugov_policy *sg_polic |
1372 |
+ return tunables; |
1373 |
+ } |
1374 |
+ |
1375 |
+-static void sugov_tunables_free(struct sugov_tunables *tunables) |
1376 |
++static void sugov_clear_global_tunables(void) |
1377 |
+ { |
1378 |
+ if (!have_governor_per_policy()) |
1379 |
+ global_tunables = NULL; |
1380 |
+- |
1381 |
+- kfree(tunables); |
1382 |
+ } |
1383 |
+ |
1384 |
+ static int sugov_init(struct cpufreq_policy *policy) |
1385 |
+@@ -794,7 +800,7 @@ out: |
1386 |
+ fail: |
1387 |
+ kobject_put(&tunables->attr_set.kobj); |
1388 |
+ policy->governor_data = NULL; |
1389 |
+- sugov_tunables_free(tunables); |
1390 |
++ sugov_clear_global_tunables(); |
1391 |
+ |
1392 |
+ stop_kthread: |
1393 |
+ sugov_kthread_stop(sg_policy); |
1394 |
+@@ -821,7 +827,7 @@ static void sugov_exit(struct cpufreq_policy *policy) |
1395 |
+ count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook); |
1396 |
+ policy->governor_data = NULL; |
1397 |
+ if (!count) |
1398 |
+- sugov_tunables_free(tunables); |
1399 |
++ sugov_clear_global_tunables(); |
1400 |
+ |
1401 |
+ mutex_unlock(&global_tunables_lock); |
1402 |
+ |
1403 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
1404 |
+index 452883b28abab..57b7a10703c36 100644 |
1405 |
+--- a/net/core/sock.c |
1406 |
++++ b/net/core/sock.c |
1407 |
+@@ -1181,6 +1181,16 @@ set_rcvbuf: |
1408 |
+ } |
1409 |
+ EXPORT_SYMBOL(sock_setsockopt); |
1410 |
+ |
1411 |
++static const struct cred *sk_get_peer_cred(struct sock *sk) |
1412 |
++{ |
1413 |
++ const struct cred *cred; |
1414 |
++ |
1415 |
++ spin_lock(&sk->sk_peer_lock); |
1416 |
++ cred = get_cred(sk->sk_peer_cred); |
1417 |
++ spin_unlock(&sk->sk_peer_lock); |
1418 |
++ |
1419 |
++ return cred; |
1420 |
++} |
1421 |
+ |
1422 |
+ static void cred_to_ucred(struct pid *pid, const struct cred *cred, |
1423 |
+ struct ucred *ucred) |
1424 |
+@@ -1355,7 +1365,11 @@ int sock_getsockopt(struct socket *sock, int level, int optname, |
1425 |
+ struct ucred peercred; |
1426 |
+ if (len > sizeof(peercred)) |
1427 |
+ len = sizeof(peercred); |
1428 |
++ |
1429 |
++ spin_lock(&sk->sk_peer_lock); |
1430 |
+ cred_to_ucred(sk->sk_peer_pid, sk->sk_peer_cred, &peercred); |
1431 |
++ spin_unlock(&sk->sk_peer_lock); |
1432 |
++ |
1433 |
+ if (copy_to_user(optval, &peercred, len)) |
1434 |
+ return -EFAULT; |
1435 |
+ goto lenout; |
1436 |
+@@ -1363,20 +1377,23 @@ int sock_getsockopt(struct socket *sock, int level, int optname, |
1437 |
+ |
1438 |
+ case SO_PEERGROUPS: |
1439 |
+ { |
1440 |
++ const struct cred *cred; |
1441 |
+ int ret, n; |
1442 |
+ |
1443 |
+- if (!sk->sk_peer_cred) |
1444 |
++ cred = sk_get_peer_cred(sk); |
1445 |
++ if (!cred) |
1446 |
+ return -ENODATA; |
1447 |
+ |
1448 |
+- n = sk->sk_peer_cred->group_info->ngroups; |
1449 |
++ n = cred->group_info->ngroups; |
1450 |
+ if (len < n * sizeof(gid_t)) { |
1451 |
+ len = n * sizeof(gid_t); |
1452 |
++ put_cred(cred); |
1453 |
+ return put_user(len, optlen) ? -EFAULT : -ERANGE; |
1454 |
+ } |
1455 |
+ len = n * sizeof(gid_t); |
1456 |
+ |
1457 |
+- ret = groups_to_user((gid_t __user *)optval, |
1458 |
+- sk->sk_peer_cred->group_info); |
1459 |
++ ret = groups_to_user((gid_t __user *)optval, cred->group_info); |
1460 |
++ put_cred(cred); |
1461 |
+ if (ret) |
1462 |
+ return ret; |
1463 |
+ goto lenout; |
1464 |
+@@ -1714,9 +1731,10 @@ static void __sk_destruct(struct rcu_head *head) |
1465 |
+ sk->sk_frag.page = NULL; |
1466 |
+ } |
1467 |
+ |
1468 |
+- if (sk->sk_peer_cred) |
1469 |
+- put_cred(sk->sk_peer_cred); |
1470 |
++ /* We do not need to acquire sk->sk_peer_lock, we are the last user. */ |
1471 |
++ put_cred(sk->sk_peer_cred); |
1472 |
+ put_pid(sk->sk_peer_pid); |
1473 |
++ |
1474 |
+ if (likely(sk->sk_net_refcnt)) |
1475 |
+ put_net(sock_net(sk)); |
1476 |
+ sk_prot_free(sk->sk_prot_creator, sk); |
1477 |
+@@ -2915,6 +2933,8 @@ void sock_init_data(struct socket *sock, struct sock *sk) |
1478 |
+ |
1479 |
+ sk->sk_peer_pid = NULL; |
1480 |
+ sk->sk_peer_cred = NULL; |
1481 |
++ spin_lock_init(&sk->sk_peer_lock); |
1482 |
++ |
1483 |
+ sk->sk_write_pending = 0; |
1484 |
+ sk->sk_rcvlowat = 1; |
1485 |
+ sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; |
1486 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
1487 |
+index b1b3220917ca0..dce85a9c20c60 100644 |
1488 |
+--- a/net/ipv4/fib_semantics.c |
1489 |
++++ b/net/ipv4/fib_semantics.c |
1490 |
+@@ -1654,7 +1654,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info); |
1491 |
+ |
1492 |
+ #if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6) |
1493 |
+ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, |
1494 |
+- int nh_weight, u8 rt_family) |
1495 |
++ int nh_weight, u8 rt_family, u32 nh_tclassid) |
1496 |
+ { |
1497 |
+ const struct net_device *dev = nhc->nhc_dev; |
1498 |
+ struct rtnexthop *rtnh; |
1499 |
+@@ -1672,6 +1672,9 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, |
1500 |
+ |
1501 |
+ rtnh->rtnh_flags = flags; |
1502 |
+ |
1503 |
++ if (nh_tclassid && nla_put_u32(skb, RTA_FLOW, nh_tclassid)) |
1504 |
++ goto nla_put_failure; |
1505 |
++ |
1506 |
+ /* length of rtnetlink header + attributes */ |
1507 |
+ rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh; |
1508 |
+ |
1509 |
+@@ -1699,14 +1702,13 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi) |
1510 |
+ } |
1511 |
+ |
1512 |
+ for_nexthops(fi) { |
1513 |
+- if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, |
1514 |
+- AF_INET) < 0) |
1515 |
+- goto nla_put_failure; |
1516 |
++ u32 nh_tclassid = 0; |
1517 |
+ #ifdef CONFIG_IP_ROUTE_CLASSID |
1518 |
+- if (nh->nh_tclassid && |
1519 |
+- nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) |
1520 |
+- goto nla_put_failure; |
1521 |
++ nh_tclassid = nh->nh_tclassid; |
1522 |
+ #endif |
1523 |
++ if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, |
1524 |
++ AF_INET, nh_tclassid) < 0) |
1525 |
++ goto nla_put_failure; |
1526 |
+ } endfor_nexthops(fi); |
1527 |
+ |
1528 |
+ mp_end: |
1529 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
1530 |
+index 6f277bd30ea3c..de04d99418850 100644 |
1531 |
+--- a/net/ipv4/udp.c |
1532 |
++++ b/net/ipv4/udp.c |
1533 |
+@@ -981,7 +981,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
1534 |
+ __be16 dport; |
1535 |
+ u8 tos; |
1536 |
+ int err, is_udplite = IS_UDPLITE(sk); |
1537 |
+- int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; |
1538 |
++ int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE; |
1539 |
+ int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); |
1540 |
+ struct sk_buff *skb; |
1541 |
+ struct ip_options_data opt_copy; |
1542 |
+@@ -1289,7 +1289,7 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset, |
1543 |
+ } |
1544 |
+ |
1545 |
+ up->len += size; |
1546 |
+- if (!(up->corkflag || (flags&MSG_MORE))) |
1547 |
++ if (!(READ_ONCE(up->corkflag) || (flags&MSG_MORE))) |
1548 |
+ ret = udp_push_pending_frames(sk); |
1549 |
+ if (!ret) |
1550 |
+ ret = size; |
1551 |
+@@ -2551,9 +2551,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, |
1552 |
+ switch (optname) { |
1553 |
+ case UDP_CORK: |
1554 |
+ if (val != 0) { |
1555 |
+- up->corkflag = 1; |
1556 |
++ WRITE_ONCE(up->corkflag, 1); |
1557 |
+ } else { |
1558 |
+- up->corkflag = 0; |
1559 |
++ WRITE_ONCE(up->corkflag, 0); |
1560 |
+ lock_sock(sk); |
1561 |
+ push_pending_frames(sk); |
1562 |
+ release_sock(sk); |
1563 |
+@@ -2676,7 +2676,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, |
1564 |
+ |
1565 |
+ switch (optname) { |
1566 |
+ case UDP_CORK: |
1567 |
+- val = up->corkflag; |
1568 |
++ val = READ_ONCE(up->corkflag); |
1569 |
+ break; |
1570 |
+ |
1571 |
+ case UDP_ENCAP: |
1572 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
1573 |
+index 575bd0f1b0089..3fb259c20546e 100644 |
1574 |
+--- a/net/ipv6/route.c |
1575 |
++++ b/net/ipv6/route.c |
1576 |
+@@ -5523,14 +5523,15 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, |
1577 |
+ goto nla_put_failure; |
1578 |
+ |
1579 |
+ if (fib_add_nexthop(skb, &rt->fib6_nh->nh_common, |
1580 |
+- rt->fib6_nh->fib_nh_weight, AF_INET6) < 0) |
1581 |
++ rt->fib6_nh->fib_nh_weight, AF_INET6, |
1582 |
++ 0) < 0) |
1583 |
+ goto nla_put_failure; |
1584 |
+ |
1585 |
+ list_for_each_entry_safe(sibling, next_sibling, |
1586 |
+ &rt->fib6_siblings, fib6_siblings) { |
1587 |
+ if (fib_add_nexthop(skb, &sibling->fib6_nh->nh_common, |
1588 |
+ sibling->fib6_nh->fib_nh_weight, |
1589 |
+- AF_INET6) < 0) |
1590 |
++ AF_INET6, 0) < 0) |
1591 |
+ goto nla_put_failure; |
1592 |
+ } |
1593 |
+ |
1594 |
+diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
1595 |
+index 776427e80efbd..5b8266f3e47f0 100644 |
1596 |
+--- a/net/ipv6/udp.c |
1597 |
++++ b/net/ipv6/udp.c |
1598 |
+@@ -1231,7 +1231,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
1599 |
+ int addr_len = msg->msg_namelen; |
1600 |
+ bool connected = false; |
1601 |
+ int ulen = len; |
1602 |
+- int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; |
1603 |
++ int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE; |
1604 |
+ int err; |
1605 |
+ int is_udplite = IS_UDPLITE(sk); |
1606 |
+ int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); |
1607 |
+diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c |
1608 |
+index 031e905f684a2..bf83f512f748b 100644 |
1609 |
+--- a/net/mac80211/mesh_ps.c |
1610 |
++++ b/net/mac80211/mesh_ps.c |
1611 |
+@@ -2,6 +2,7 @@ |
1612 |
+ /* |
1613 |
+ * Copyright 2012-2013, Marco Porsch <marco.porsch@×××××××××××××××××.de> |
1614 |
+ * Copyright 2012-2013, cozybit Inc. |
1615 |
++ * Copyright (C) 2021 Intel Corporation |
1616 |
+ */ |
1617 |
+ |
1618 |
+ #include "mesh.h" |
1619 |
+@@ -584,7 +585,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta, |
1620 |
+ |
1621 |
+ /* only transmit to PS STA with announced, non-zero awake window */ |
1622 |
+ if (test_sta_flag(sta, WLAN_STA_PS_STA) && |
1623 |
+- (!elems->awake_window || !le16_to_cpu(*elems->awake_window))) |
1624 |
++ (!elems->awake_window || !get_unaligned_le16(elems->awake_window))) |
1625 |
+ return; |
1626 |
+ |
1627 |
+ if (!test_sta_flag(sta, WLAN_STA_MPSP_OWNER)) |
1628 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
1629 |
+index 4dfac7a25e5ad..d82d22b6a2a94 100644 |
1630 |
+--- a/net/mac80211/tx.c |
1631 |
++++ b/net/mac80211/tx.c |
1632 |
+@@ -2156,7 +2156,11 @@ static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local, |
1633 |
+ } |
1634 |
+ |
1635 |
+ vht_mcs = iterator.this_arg[4] >> 4; |
1636 |
++ if (vht_mcs > 11) |
1637 |
++ vht_mcs = 0; |
1638 |
+ vht_nss = iterator.this_arg[4] & 0xF; |
1639 |
++ if (!vht_nss || vht_nss > 8) |
1640 |
++ vht_nss = 1; |
1641 |
+ break; |
1642 |
+ |
1643 |
+ /* |
1644 |
+@@ -3325,6 +3329,14 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, |
1645 |
+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) |
1646 |
+ goto out; |
1647 |
+ |
1648 |
++ /* If n == 2, the "while (*frag_tail)" loop above didn't execute |
1649 |
++ * and frag_tail should be &skb_shinfo(head)->frag_list. |
1650 |
++ * However, ieee80211_amsdu_prepare_head() can reallocate it. |
1651 |
++ * Reload frag_tail to have it pointing to the correct place. |
1652 |
++ */ |
1653 |
++ if (n == 2) |
1654 |
++ frag_tail = &skb_shinfo(head)->frag_list; |
1655 |
++ |
1656 |
+ /* |
1657 |
+ * Pad out the previous subframe to a multiple of 4 by adding the |
1658 |
+ * padding to the next one, that's being added. Note that head->len |
1659 |
+diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c |
1660 |
+index bca47fad5a162..4eed23e276104 100644 |
1661 |
+--- a/net/mac80211/wpa.c |
1662 |
++++ b/net/mac80211/wpa.c |
1663 |
+@@ -520,6 +520,9 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx, |
1664 |
+ return RX_DROP_UNUSABLE; |
1665 |
+ } |
1666 |
+ |
1667 |
++ /* reload hdr - skb might have been reallocated */ |
1668 |
++ hdr = (void *)rx->skb->data; |
1669 |
++ |
1670 |
+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len; |
1671 |
+ if (!rx->sta || data_len < 0) |
1672 |
+ return RX_DROP_UNUSABLE; |
1673 |
+@@ -749,6 +752,9 @@ ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx) |
1674 |
+ return RX_DROP_UNUSABLE; |
1675 |
+ } |
1676 |
+ |
1677 |
++ /* reload hdr - skb might have been reallocated */ |
1678 |
++ hdr = (void *)rx->skb->data; |
1679 |
++ |
1680 |
+ data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN - mic_len; |
1681 |
+ if (!rx->sta || data_len < 0) |
1682 |
+ return RX_DROP_UNUSABLE; |
1683 |
+diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h |
1684 |
+index 500de37858ac8..1b44dfa7ba856 100644 |
1685 |
+--- a/net/netfilter/ipset/ip_set_hash_gen.h |
1686 |
++++ b/net/netfilter/ipset/ip_set_hash_gen.h |
1687 |
+@@ -132,11 +132,11 @@ htable_size(u8 hbits) |
1688 |
+ { |
1689 |
+ size_t hsize; |
1690 |
+ |
1691 |
+- /* We must fit both into u32 in jhash and size_t */ |
1692 |
++ /* We must fit both into u32 in jhash and INT_MAX in kvmalloc_node() */ |
1693 |
+ if (hbits > 31) |
1694 |
+ return 0; |
1695 |
+ hsize = jhash_size(hbits); |
1696 |
+- if ((((size_t)-1) - sizeof(struct htable)) / sizeof(struct hbucket *) |
1697 |
++ if ((INT_MAX - sizeof(struct htable)) / sizeof(struct hbucket *) |
1698 |
+ < hsize) |
1699 |
+ return 0; |
1700 |
+ |
1701 |
+diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c |
1702 |
+index 02f2f636798d1..d1524ca4b90ef 100644 |
1703 |
+--- a/net/netfilter/ipvs/ip_vs_conn.c |
1704 |
++++ b/net/netfilter/ipvs/ip_vs_conn.c |
1705 |
+@@ -1394,6 +1394,10 @@ int __init ip_vs_conn_init(void) |
1706 |
+ int idx; |
1707 |
+ |
1708 |
+ /* Compute size and mask */ |
1709 |
++ if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 20) { |
1710 |
++ pr_info("conn_tab_bits not in [8, 20]. Using default value\n"); |
1711 |
++ ip_vs_conn_tab_bits = CONFIG_IP_VS_TAB_BITS; |
1712 |
++ } |
1713 |
+ ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits; |
1714 |
+ ip_vs_conn_tab_mask = ip_vs_conn_tab_size - 1; |
1715 |
+ |
1716 |
+diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c |
1717 |
+index c5a0f2c2635ed..26979b4853bdb 100644 |
1718 |
+--- a/net/sched/cls_flower.c |
1719 |
++++ b/net/sched/cls_flower.c |
1720 |
+@@ -1741,18 +1741,24 @@ static void fl_walk(struct tcf_proto *tp, struct tcf_walker *arg, |
1721 |
+ |
1722 |
+ arg->count = arg->skip; |
1723 |
+ |
1724 |
++ rcu_read_lock(); |
1725 |
+ idr_for_each_entry_continue_ul(&head->handle_idr, f, tmp, id) { |
1726 |
+ /* don't return filters that are being deleted */ |
1727 |
+ if (!refcount_inc_not_zero(&f->refcnt)) |
1728 |
+ continue; |
1729 |
++ rcu_read_unlock(); |
1730 |
++ |
1731 |
+ if (arg->fn(tp, f, arg) < 0) { |
1732 |
+ __fl_put(f); |
1733 |
+ arg->stop = 1; |
1734 |
++ rcu_read_lock(); |
1735 |
+ break; |
1736 |
+ } |
1737 |
+ __fl_put(f); |
1738 |
+ arg->count++; |
1739 |
++ rcu_read_lock(); |
1740 |
+ } |
1741 |
++ rcu_read_unlock(); |
1742 |
+ arg->cookie = id; |
1743 |
+ } |
1744 |
+ |
1745 |
+diff --git a/net/sctp/input.c b/net/sctp/input.c |
1746 |
+index 2aca37717ed1e..9616b600a8766 100644 |
1747 |
+--- a/net/sctp/input.c |
1748 |
++++ b/net/sctp/input.c |
1749 |
+@@ -676,7 +676,7 @@ static int sctp_rcv_ootb(struct sk_buff *skb) |
1750 |
+ ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); |
1751 |
+ |
1752 |
+ /* Break out if chunk length is less then minimal. */ |
1753 |
+- if (ntohs(ch->length) < sizeof(_ch)) |
1754 |
++ if (!ch || ntohs(ch->length) < sizeof(_ch)) |
1755 |
+ break; |
1756 |
+ |
1757 |
+ ch_end = offset + SCTP_PAD4(ntohs(ch->length)); |
1758 |
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
1759 |
+index 3098710c9c344..05470ca91bd94 100644 |
1760 |
+--- a/net/unix/af_unix.c |
1761 |
++++ b/net/unix/af_unix.c |
1762 |
+@@ -595,20 +595,42 @@ static void unix_release_sock(struct sock *sk, int embrion) |
1763 |
+ |
1764 |
+ static void init_peercred(struct sock *sk) |
1765 |
+ { |
1766 |
+- put_pid(sk->sk_peer_pid); |
1767 |
+- if (sk->sk_peer_cred) |
1768 |
+- put_cred(sk->sk_peer_cred); |
1769 |
++ const struct cred *old_cred; |
1770 |
++ struct pid *old_pid; |
1771 |
++ |
1772 |
++ spin_lock(&sk->sk_peer_lock); |
1773 |
++ old_pid = sk->sk_peer_pid; |
1774 |
++ old_cred = sk->sk_peer_cred; |
1775 |
+ sk->sk_peer_pid = get_pid(task_tgid(current)); |
1776 |
+ sk->sk_peer_cred = get_current_cred(); |
1777 |
++ spin_unlock(&sk->sk_peer_lock); |
1778 |
++ |
1779 |
++ put_pid(old_pid); |
1780 |
++ put_cred(old_cred); |
1781 |
+ } |
1782 |
+ |
1783 |
+ static void copy_peercred(struct sock *sk, struct sock *peersk) |
1784 |
+ { |
1785 |
+- put_pid(sk->sk_peer_pid); |
1786 |
+- if (sk->sk_peer_cred) |
1787 |
+- put_cred(sk->sk_peer_cred); |
1788 |
++ const struct cred *old_cred; |
1789 |
++ struct pid *old_pid; |
1790 |
++ |
1791 |
++ if (sk < peersk) { |
1792 |
++ spin_lock(&sk->sk_peer_lock); |
1793 |
++ spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING); |
1794 |
++ } else { |
1795 |
++ spin_lock(&peersk->sk_peer_lock); |
1796 |
++ spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING); |
1797 |
++ } |
1798 |
++ old_pid = sk->sk_peer_pid; |
1799 |
++ old_cred = sk->sk_peer_cred; |
1800 |
+ sk->sk_peer_pid = get_pid(peersk->sk_peer_pid); |
1801 |
+ sk->sk_peer_cred = get_cred(peersk->sk_peer_cred); |
1802 |
++ |
1803 |
++ spin_unlock(&sk->sk_peer_lock); |
1804 |
++ spin_unlock(&peersk->sk_peer_lock); |
1805 |
++ |
1806 |
++ put_pid(old_pid); |
1807 |
++ put_cred(old_cred); |
1808 |
+ } |
1809 |
+ |
1810 |
+ static int unix_listen(struct socket *sock, int backlog) |
1811 |
+diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
1812 |
+index 59ea56945e6cd..b497bb85b667f 100755 |
1813 |
+--- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
1814 |
++++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh |
1815 |
+@@ -112,6 +112,14 @@ setup() |
1816 |
+ ip netns add "${NS2}" |
1817 |
+ ip netns add "${NS3}" |
1818 |
+ |
1819 |
++ # rp_filter gets confused by what these tests are doing, so disable it |
1820 |
++ ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
1821 |
++ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
1822 |
++ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
1823 |
++ ip netns exec ${NS1} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
1824 |
++ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
1825 |
++ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 |
1826 |
++ |
1827 |
+ ip link add veth1 type veth peer name veth2 |
1828 |
+ ip link add veth3 type veth peer name veth4 |
1829 |
+ ip link add veth5 type veth peer name veth6 |
1830 |
+@@ -236,11 +244,6 @@ setup() |
1831 |
+ ip -netns ${NS1} -6 route add ${IPv6_GRE}/128 dev veth5 via ${IPv6_6} ${VRF} |
1832 |
+ ip -netns ${NS2} -6 route add ${IPv6_GRE}/128 dev veth7 via ${IPv6_8} ${VRF} |
1833 |
+ |
1834 |
+- # rp_filter gets confused by what these tests are doing, so disable it |
1835 |
+- ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
1836 |
+- ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
1837 |
+- ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 |
1838 |
+- |
1839 |
+ TMPFILE=$(mktemp /tmp/test_lwt_ip_encap.XXXXXX) |
1840 |
+ |
1841 |
+ sleep 1 # reduce flakiness |