Contents of /trunk/kernel-alx-legacy/patches-4.9/0362-4.9.263-all-fixes.patch
Parent Directory | Revision Log
Revision 3664 -
(show annotations)
(download)
Mon Oct 24 14:07:41 2022 UTC (22 months, 4 weeks ago) by niro
File size: 37674 byte(s)
Mon Oct 24 14:07:41 2022 UTC (22 months, 4 weeks ago) by niro
File size: 37674 byte(s)
-linux-4.9.263
1 | diff --git a/Makefile b/Makefile |
2 | index be5eac0a12d37..80b265a383bb6 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 262 |
9 | +SUBLEVEL = 263 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c |
14 | index f562ddbeb20c6..f39838d78976d 100644 |
15 | --- a/arch/x86/events/intel/ds.c |
16 | +++ b/arch/x86/events/intel/ds.c |
17 | @@ -1473,7 +1473,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) |
18 | */ |
19 | if (!pebs_status && cpuc->pebs_enabled && |
20 | !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1))) |
21 | - pebs_status = cpuc->pebs_enabled; |
22 | + pebs_status = p->status = cpuc->pebs_enabled; |
23 | |
24 | bit = find_first_bit((unsigned long *)&pebs_status, |
25 | x86_pmu.max_pebs_events); |
26 | diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h |
27 | index 7aa9a9bd9d982..f606ef5989172 100644 |
28 | --- a/arch/x86/include/asm/processor.h |
29 | +++ b/arch/x86/include/asm/processor.h |
30 | @@ -461,15 +461,6 @@ struct thread_struct { |
31 | */ |
32 | }; |
33 | |
34 | -/* |
35 | - * Thread-synchronous status. |
36 | - * |
37 | - * This is different from the flags in that nobody else |
38 | - * ever touches our thread-synchronous status, so we don't |
39 | - * have to worry about atomic accesses. |
40 | - */ |
41 | -#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/ |
42 | - |
43 | /* |
44 | * Set IOPL bits in EFLAGS from given mask |
45 | */ |
46 | diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h |
47 | index 0438f7fbb3839..3ba5e2fce1718 100644 |
48 | --- a/arch/x86/include/asm/thread_info.h |
49 | +++ b/arch/x86/include/asm/thread_info.h |
50 | @@ -221,10 +221,31 @@ static inline int arch_within_stack_frames(const void * const stack, |
51 | |
52 | #endif |
53 | |
54 | +/* |
55 | + * Thread-synchronous status. |
56 | + * |
57 | + * This is different from the flags in that nobody else |
58 | + * ever touches our thread-synchronous status, so we don't |
59 | + * have to worry about atomic accesses. |
60 | + */ |
61 | +#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/ |
62 | + |
63 | +#ifndef __ASSEMBLY__ |
64 | #ifdef CONFIG_COMPAT |
65 | #define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */ |
66 | +#define TS_COMPAT_RESTART 0x0008 |
67 | + |
68 | +#define arch_set_restart_data arch_set_restart_data |
69 | + |
70 | +static inline void arch_set_restart_data(struct restart_block *restart) |
71 | +{ |
72 | + struct thread_info *ti = current_thread_info(); |
73 | + if (ti->status & TS_COMPAT) |
74 | + ti->status |= TS_COMPAT_RESTART; |
75 | + else |
76 | + ti->status &= ~TS_COMPAT_RESTART; |
77 | +} |
78 | #endif |
79 | -#ifndef __ASSEMBLY__ |
80 | |
81 | #ifdef CONFIG_X86_32 |
82 | #define in_ia32_syscall() true |
83 | diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
84 | index 3401b28f13121..f398612e8a816 100644 |
85 | --- a/arch/x86/kernel/apic/io_apic.c |
86 | +++ b/arch/x86/kernel/apic/io_apic.c |
87 | @@ -1042,6 +1042,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, |
88 | if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) { |
89 | irq = mp_irqs[idx].srcbusirq; |
90 | legacy = mp_is_legacy_irq(irq); |
91 | + /* |
92 | + * IRQ2 is unusable for historical reasons on systems which |
93 | + * have a legacy PIC. See the comment vs. IRQ2 further down. |
94 | + * |
95 | + * If this gets removed at some point then the related code |
96 | + * in lapic_assign_system_vectors() needs to be adjusted as |
97 | + * well. |
98 | + */ |
99 | + if (legacy && irq == PIC_CASCADE_IR) |
100 | + return -EINVAL; |
101 | } |
102 | |
103 | mutex_lock(&ioapic_mutex); |
104 | diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c |
105 | index ca010dfb9682b..4050d5092c86b 100644 |
106 | --- a/arch/x86/kernel/signal.c |
107 | +++ b/arch/x86/kernel/signal.c |
108 | @@ -767,30 +767,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
109 | |
110 | static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs) |
111 | { |
112 | - /* |
113 | - * This function is fundamentally broken as currently |
114 | - * implemented. |
115 | - * |
116 | - * The idea is that we want to trigger a call to the |
117 | - * restart_block() syscall and that we want in_ia32_syscall(), |
118 | - * in_x32_syscall(), etc. to match whatever they were in the |
119 | - * syscall being restarted. We assume that the syscall |
120 | - * instruction at (regs->ip - 2) matches whatever syscall |
121 | - * instruction we used to enter in the first place. |
122 | - * |
123 | - * The problem is that we can get here when ptrace pokes |
124 | - * syscall-like values into regs even if we're not in a syscall |
125 | - * at all. |
126 | - * |
127 | - * For now, we maintain historical behavior and guess based on |
128 | - * stored state. We could do better by saving the actual |
129 | - * syscall arch in restart_block or (with caveats on x32) by |
130 | - * checking if regs->ip points to 'int $0x80'. The current |
131 | - * behavior is incorrect if a tracer has a different bitness |
132 | - * than the tracee. |
133 | - */ |
134 | #ifdef CONFIG_IA32_EMULATION |
135 | - if (current_thread_info()->status & (TS_COMPAT|TS_I386_REGS_POKED)) |
136 | + if (current_thread_info()->status & TS_COMPAT_RESTART) |
137 | return __NR_ia32_restart_syscall; |
138 | #endif |
139 | #ifdef CONFIG_X86_X32_ABI |
140 | diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c |
141 | index fb7c0dbed51cb..67837905f7b45 100644 |
142 | --- a/drivers/iio/imu/adis16400_core.c |
143 | +++ b/drivers/iio/imu/adis16400_core.c |
144 | @@ -288,8 +288,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev) |
145 | if (ret) |
146 | goto err_ret; |
147 | |
148 | - ret = sscanf(indio_dev->name, "adis%u\n", &device_id); |
149 | - if (ret != 1) { |
150 | + if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) { |
151 | ret = -EINVAL; |
152 | goto err_ret; |
153 | } |
154 | diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c |
155 | index 5ec0042bc3840..b6867a8915dac 100644 |
156 | --- a/drivers/net/dsa/b53/b53_common.c |
157 | +++ b/drivers/net/dsa/b53/b53_common.c |
158 | @@ -502,6 +502,19 @@ static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) |
159 | } |
160 | } |
161 | |
162 | +static void b53_port_set_learning(struct b53_device *dev, int port, |
163 | + bool learning) |
164 | +{ |
165 | + u16 reg; |
166 | + |
167 | + b53_read16(dev, B53_CTRL_PAGE, B53_DIS_LEARNING, ®); |
168 | + if (learning) |
169 | + reg &= ~BIT(port); |
170 | + else |
171 | + reg |= BIT(port); |
172 | + b53_write16(dev, B53_CTRL_PAGE, B53_DIS_LEARNING, reg); |
173 | +} |
174 | + |
175 | static int b53_enable_port(struct dsa_switch *ds, int port, |
176 | struct phy_device *phy) |
177 | { |
178 | @@ -509,6 +522,8 @@ static int b53_enable_port(struct dsa_switch *ds, int port, |
179 | unsigned int cpu_port = dev->cpu_port; |
180 | u16 pvlan; |
181 | |
182 | + b53_port_set_learning(dev, port, false); |
183 | + |
184 | /* Clear the Rx and Tx disable bits and set to no spanning tree */ |
185 | b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), 0); |
186 | |
187 | @@ -552,6 +567,8 @@ static void b53_enable_cpu_port(struct b53_device *dev) |
188 | PORT_CTRL_RX_MCST_EN | |
189 | PORT_CTRL_RX_UCST_EN; |
190 | b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(cpu_port), port_ctrl); |
191 | + |
192 | + b53_port_set_learning(dev, cpu_port, false); |
193 | } |
194 | |
195 | static void b53_enable_mib(struct b53_device *dev) |
196 | @@ -1375,6 +1392,8 @@ static int b53_br_join(struct dsa_switch *ds, int port, |
197 | b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan); |
198 | dev->ports[port].vlan_ctl_mask = pvlan; |
199 | |
200 | + b53_port_set_learning(dev, port, true); |
201 | + |
202 | return 0; |
203 | } |
204 | |
205 | @@ -1426,6 +1445,7 @@ static void b53_br_leave(struct dsa_switch *ds, int port) |
206 | vl->untag |= BIT(port) | BIT(dev->cpu_port); |
207 | b53_set_vlan_entry(dev, pvid, vl); |
208 | } |
209 | + b53_port_set_learning(dev, port, false); |
210 | } |
211 | |
212 | static void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state) |
213 | diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h |
214 | index 3cf246c6bdcc4..aed70e76006da 100644 |
215 | --- a/drivers/net/dsa/b53/b53_regs.h |
216 | +++ b/drivers/net/dsa/b53/b53_regs.h |
217 | @@ -112,6 +112,7 @@ |
218 | #define B53_UC_FLOOD_MASK 0x32 |
219 | #define B53_MC_FLOOD_MASK 0x34 |
220 | #define B53_IPMC_FLOOD_MASK 0x36 |
221 | +#define B53_DIS_LEARNING 0x3c |
222 | |
223 | /* |
224 | * Override Ports 0-7 State on devices with xMII interfaces (8 bit) |
225 | diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c |
226 | index a3742a3b413cd..0c69d5858558a 100644 |
227 | --- a/drivers/net/dsa/bcm_sf2.c |
228 | +++ b/drivers/net/dsa/bcm_sf2.c |
229 | @@ -224,6 +224,11 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, |
230 | reg &= ~P_TXQ_PSM_VDD(port); |
231 | core_writel(priv, reg, CORE_MEM_PSM_VDD_CTRL); |
232 | |
233 | + /* Disable learning */ |
234 | + reg = core_readl(priv, CORE_DIS_LEARN); |
235 | + reg |= BIT(port); |
236 | + core_writel(priv, reg, CORE_DIS_LEARN); |
237 | + |
238 | /* Clear the Rx and Tx disable bits and set to no spanning tree */ |
239 | core_writel(priv, 0, CORE_G_PCTL_PORT(port)); |
240 | |
241 | diff --git a/drivers/net/dsa/bcm_sf2_regs.h b/drivers/net/dsa/bcm_sf2_regs.h |
242 | index 838fe373cd6f7..ca1d1f2e1161a 100644 |
243 | --- a/drivers/net/dsa/bcm_sf2_regs.h |
244 | +++ b/drivers/net/dsa/bcm_sf2_regs.h |
245 | @@ -138,6 +138,8 @@ |
246 | #define CORE_SWITCH_CTRL 0x00088 |
247 | #define MII_DUMB_FWDG_EN (1 << 6) |
248 | |
249 | +#define CORE_DIS_LEARN 0x000f0 |
250 | + |
251 | #define CORE_SFT_LRN_CTRL 0x000f8 |
252 | #define SW_LEARN_CNTL(x) (1 << (x)) |
253 | |
254 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h |
255 | index b06e32d0d22af..293ff8cc69948 100644 |
256 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h |
257 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h |
258 | @@ -991,6 +991,7 @@ void ixgbe_ptp_suspend(struct ixgbe_adapter *adapter); |
259 | void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); |
260 | void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); |
261 | void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter); |
262 | +void ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter); |
263 | void ixgbe_ptp_rx_pktstamp(struct ixgbe_q_vector *, struct sk_buff *); |
264 | void ixgbe_ptp_rx_rgtstamp(struct ixgbe_q_vector *, struct sk_buff *skb); |
265 | static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, |
266 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
267 | index 4c729faeb7132..36d73bf32f4fb 100644 |
268 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
269 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
270 | @@ -7257,7 +7257,9 @@ static void ixgbe_service_task(struct work_struct *work) |
271 | |
272 | if (test_bit(__IXGBE_PTP_RUNNING, &adapter->state)) { |
273 | ixgbe_ptp_overflow_check(adapter); |
274 | - ixgbe_ptp_rx_hang(adapter); |
275 | + if (adapter->flags & IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER) |
276 | + ixgbe_ptp_rx_hang(adapter); |
277 | + ixgbe_ptp_tx_hang(adapter); |
278 | } |
279 | |
280 | ixgbe_service_event_complete(adapter); |
281 | diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c |
282 | index a92277683a649..a93a1b3bb8e4d 100644 |
283 | --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c |
284 | +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c |
285 | @@ -662,6 +662,33 @@ static void ixgbe_ptp_clear_tx_timestamp(struct ixgbe_adapter *adapter) |
286 | clear_bit_unlock(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); |
287 | } |
288 | |
289 | +/** |
290 | + * ixgbe_ptp_tx_hang - detect error case where Tx timestamp never finishes |
291 | + * @adapter: private network adapter structure |
292 | + */ |
293 | +void ixgbe_ptp_tx_hang(struct ixgbe_adapter *adapter) |
294 | +{ |
295 | + bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + |
296 | + IXGBE_PTP_TX_TIMEOUT); |
297 | + |
298 | + if (!adapter->ptp_tx_skb) |
299 | + return; |
300 | + |
301 | + if (!test_bit(__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state)) |
302 | + return; |
303 | + |
304 | + /* If we haven't received a timestamp within the timeout, it is |
305 | + * reasonable to assume that it will never occur, so we can unlock the |
306 | + * timestamp bit when this occurs. |
307 | + */ |
308 | + if (timeout) { |
309 | + cancel_work_sync(&adapter->ptp_tx_work); |
310 | + ixgbe_ptp_clear_tx_timestamp(adapter); |
311 | + adapter->tx_hwtstamp_timeouts++; |
312 | + e_warn(drv, "clearing Tx timestamp hang\n"); |
313 | + } |
314 | +} |
315 | + |
316 | /** |
317 | * ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp |
318 | * @adapter: the private adapter struct |
319 | diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c |
320 | index 4b58f352c0c93..fb2461cc3c693 100644 |
321 | --- a/drivers/nvme/target/core.c |
322 | +++ b/drivers/nvme/target/core.c |
323 | @@ -574,9 +574,20 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl) |
324 | { |
325 | lockdep_assert_held(&ctrl->lock); |
326 | |
327 | - if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES || |
328 | - nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES || |
329 | - nvmet_cc_mps(ctrl->cc) != 0 || |
330 | + /* |
331 | + * Only I/O controllers should verify iosqes,iocqes. |
332 | + * Strictly speaking, the spec says a discovery controller |
333 | + * should verify iosqes,iocqes are zeroed, however that |
334 | + * would break backwards compatibility, so don't enforce it. |
335 | + */ |
336 | + if (ctrl->subsys->type != NVME_NQN_DISC && |
337 | + (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES || |
338 | + nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) { |
339 | + ctrl->csts = NVME_CSTS_CFS; |
340 | + return; |
341 | + } |
342 | + |
343 | + if (nvmet_cc_mps(ctrl->cc) != 0 || |
344 | nvmet_cc_ams(ctrl->cc) != 0 || |
345 | nvmet_cc_css(ctrl->cc) != 0) { |
346 | ctrl->csts = NVME_CSTS_CFS; |
347 | diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c |
348 | index a796301ea03fb..ca9d832bd9f83 100644 |
349 | --- a/drivers/pci/hotplug/rpadlpar_sysfs.c |
350 | +++ b/drivers/pci/hotplug/rpadlpar_sysfs.c |
351 | @@ -39,12 +39,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr, |
352 | if (nbytes >= MAX_DRC_NAME_LEN) |
353 | return 0; |
354 | |
355 | - memcpy(drc_name, buf, nbytes); |
356 | + strscpy(drc_name, buf, nbytes + 1); |
357 | |
358 | end = strchr(drc_name, '\n'); |
359 | - if (!end) |
360 | - end = &drc_name[nbytes]; |
361 | - *end = '\0'; |
362 | + if (end) |
363 | + *end = '\0'; |
364 | |
365 | rc = dlpar_add_slot(drc_name); |
366 | if (rc) |
367 | @@ -70,12 +69,11 @@ static ssize_t remove_slot_store(struct kobject *kobj, |
368 | if (nbytes >= MAX_DRC_NAME_LEN) |
369 | return 0; |
370 | |
371 | - memcpy(drc_name, buf, nbytes); |
372 | + strscpy(drc_name, buf, nbytes + 1); |
373 | |
374 | end = strchr(drc_name, '\n'); |
375 | - if (!end) |
376 | - end = &drc_name[nbytes]; |
377 | - *end = '\0'; |
378 | + if (end) |
379 | + *end = '\0'; |
380 | |
381 | rc = dlpar_remove_slot(drc_name); |
382 | if (rc) |
383 | diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c |
384 | index a63542bac1533..feb00585a7a4d 100644 |
385 | --- a/drivers/scsi/lpfc/lpfc_debugfs.c |
386 | +++ b/drivers/scsi/lpfc/lpfc_debugfs.c |
387 | @@ -1061,7 +1061,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, |
388 | memset(dstbuf, 0, 33); |
389 | size = (nbytes < 32) ? nbytes : 32; |
390 | if (copy_from_user(dstbuf, buf, size)) |
391 | - return 0; |
392 | + return -EFAULT; |
393 | |
394 | if (dent == phba->debug_InjErrLBA) { |
395 | if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f')) |
396 | @@ -1069,7 +1069,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, |
397 | } |
398 | |
399 | if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp))) |
400 | - return 0; |
401 | + return -EINVAL; |
402 | |
403 | if (dent == phba->debug_writeGuard) |
404 | phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; |
405 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
406 | index c574bf981140a..f33635ab967f7 100644 |
407 | --- a/drivers/usb/gadget/composite.c |
408 | +++ b/drivers/usb/gadget/composite.c |
409 | @@ -1076,7 +1076,7 @@ static void collect_langs(struct usb_gadget_strings **sp, __le16 *buf) |
410 | while (*sp) { |
411 | s = *sp; |
412 | language = cpu_to_le16(s->language); |
413 | - for (tmp = buf; *tmp && tmp < &buf[126]; tmp++) { |
414 | + for (tmp = buf; *tmp && tmp < &buf[USB_MAX_STRING_LEN]; tmp++) { |
415 | if (*tmp == language) |
416 | goto repeat; |
417 | } |
418 | @@ -1151,7 +1151,7 @@ static int get_string(struct usb_composite_dev *cdev, |
419 | collect_langs(sp, s->wData); |
420 | } |
421 | |
422 | - for (len = 0; len <= 126 && s->wData[len]; len++) |
423 | + for (len = 0; len <= USB_MAX_STRING_LEN && s->wData[len]; len++) |
424 | continue; |
425 | if (!len) |
426 | return -EINVAL; |
427 | diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c |
428 | index 0aa1b8fa9b47a..fe1b54a8fb0c8 100644 |
429 | --- a/drivers/usb/gadget/configfs.c |
430 | +++ b/drivers/usb/gadget/configfs.c |
431 | @@ -108,21 +108,27 @@ struct gadget_config_name { |
432 | struct list_head list; |
433 | }; |
434 | |
435 | +#define USB_MAX_STRING_WITH_NULL_LEN (USB_MAX_STRING_LEN+1) |
436 | + |
437 | static int usb_string_copy(const char *s, char **s_copy) |
438 | { |
439 | int ret; |
440 | char *str; |
441 | char *copy = *s_copy; |
442 | ret = strlen(s); |
443 | - if (ret > 126) |
444 | + if (ret > USB_MAX_STRING_LEN) |
445 | return -EOVERFLOW; |
446 | |
447 | - str = kstrdup(s, GFP_KERNEL); |
448 | - if (!str) |
449 | - return -ENOMEM; |
450 | + if (copy) { |
451 | + str = copy; |
452 | + } else { |
453 | + str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL); |
454 | + if (!str) |
455 | + return -ENOMEM; |
456 | + } |
457 | + strcpy(str, s); |
458 | if (str[ret - 1] == '\n') |
459 | str[ret - 1] = '\0'; |
460 | - kfree(copy); |
461 | *s_copy = str; |
462 | return 0; |
463 | } |
464 | diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c |
465 | index 73a4dfba0edbf..0173a9969b9a0 100644 |
466 | --- a/drivers/usb/gadget/usbstring.c |
467 | +++ b/drivers/usb/gadget/usbstring.c |
468 | @@ -59,9 +59,9 @@ usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf) |
469 | return -EINVAL; |
470 | |
471 | /* string descriptors have length, tag, then UTF16-LE text */ |
472 | - len = min ((size_t) 126, strlen (s->s)); |
473 | + len = min((size_t)USB_MAX_STRING_LEN, strlen(s->s)); |
474 | len = utf8s_to_utf16s(s->s, len, UTF16_LITTLE_ENDIAN, |
475 | - (wchar_t *) &buf[2], 126); |
476 | + (wchar_t *) &buf[2], USB_MAX_STRING_LEN); |
477 | if (len < 0) |
478 | return -EINVAL; |
479 | buf [0] = (len + 1) * 2; |
480 | diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
481 | index 0eebd0bd6bc0e..cad06c60ad663 100644 |
482 | --- a/fs/btrfs/ctree.c |
483 | +++ b/fs/btrfs/ctree.c |
484 | @@ -1422,7 +1422,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq) |
485 | btrfs_warn(root->fs_info, |
486 | "failed to read tree block %llu from get_old_root", logical); |
487 | } else { |
488 | + btrfs_tree_read_lock(old); |
489 | eb = btrfs_clone_extent_buffer(old); |
490 | + btrfs_tree_read_unlock(old); |
491 | free_extent_buffer(old); |
492 | } |
493 | } else if (old_root) { |
494 | diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c |
495 | index 45c7b0f9a8e3f..c50dcda7b708a 100644 |
496 | --- a/fs/ext4/block_validity.c |
497 | +++ b/fs/ext4/block_validity.c |
498 | @@ -23,6 +23,7 @@ struct ext4_system_zone { |
499 | struct rb_node node; |
500 | ext4_fsblk_t start_blk; |
501 | unsigned int count; |
502 | + u32 ino; |
503 | }; |
504 | |
505 | static struct kmem_cache *ext4_system_zone_cachep; |
506 | @@ -43,7 +44,8 @@ void ext4_exit_system_zone(void) |
507 | static inline int can_merge(struct ext4_system_zone *entry1, |
508 | struct ext4_system_zone *entry2) |
509 | { |
510 | - if ((entry1->start_blk + entry1->count) == entry2->start_blk) |
511 | + if ((entry1->start_blk + entry1->count) == entry2->start_blk && |
512 | + entry1->ino == entry2->ino) |
513 | return 1; |
514 | return 0; |
515 | } |
516 | @@ -55,9 +57,9 @@ static inline int can_merge(struct ext4_system_zone *entry1, |
517 | */ |
518 | static int add_system_zone(struct ext4_sb_info *sbi, |
519 | ext4_fsblk_t start_blk, |
520 | - unsigned int count) |
521 | + unsigned int count, u32 ino) |
522 | { |
523 | - struct ext4_system_zone *new_entry = NULL, *entry; |
524 | + struct ext4_system_zone *new_entry, *entry; |
525 | struct rb_node **n = &sbi->system_blks.rb_node, *node; |
526 | struct rb_node *parent = NULL, *new_node = NULL; |
527 | |
528 | @@ -68,30 +70,21 @@ static int add_system_zone(struct ext4_sb_info *sbi, |
529 | n = &(*n)->rb_left; |
530 | else if (start_blk >= (entry->start_blk + entry->count)) |
531 | n = &(*n)->rb_right; |
532 | - else { |
533 | - if (start_blk + count > (entry->start_blk + |
534 | - entry->count)) |
535 | - entry->count = (start_blk + count - |
536 | - entry->start_blk); |
537 | - new_node = *n; |
538 | - new_entry = rb_entry(new_node, struct ext4_system_zone, |
539 | - node); |
540 | - break; |
541 | - } |
542 | + else /* Unexpected overlap of system zones. */ |
543 | + return -EFSCORRUPTED; |
544 | } |
545 | |
546 | - if (!new_entry) { |
547 | - new_entry = kmem_cache_alloc(ext4_system_zone_cachep, |
548 | - GFP_KERNEL); |
549 | - if (!new_entry) |
550 | - return -ENOMEM; |
551 | - new_entry->start_blk = start_blk; |
552 | - new_entry->count = count; |
553 | - new_node = &new_entry->node; |
554 | + new_entry = kmem_cache_alloc(ext4_system_zone_cachep, |
555 | + GFP_KERNEL); |
556 | + if (!new_entry) |
557 | + return -ENOMEM; |
558 | + new_entry->start_blk = start_blk; |
559 | + new_entry->count = count; |
560 | + new_entry->ino = ino; |
561 | + new_node = &new_entry->node; |
562 | |
563 | - rb_link_node(new_node, parent, n); |
564 | - rb_insert_color(new_node, &sbi->system_blks); |
565 | - } |
566 | + rb_link_node(new_node, parent, n); |
567 | + rb_insert_color(new_node, &sbi->system_blks); |
568 | |
569 | /* Can we merge to the left? */ |
570 | node = rb_prev(new_node); |
571 | @@ -163,16 +156,16 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) |
572 | if (n == 0) { |
573 | i++; |
574 | } else { |
575 | - if (!ext4_data_block_valid(sbi, map.m_pblk, n)) { |
576 | - ext4_error(sb, "blocks %llu-%llu from inode %u " |
577 | + err = add_system_zone(sbi, map.m_pblk, n, ino); |
578 | + if (err < 0) { |
579 | + if (err == -EFSCORRUPTED) { |
580 | + ext4_error(sb, |
581 | + "blocks %llu-%llu from inode %u " |
582 | "overlap system zone", map.m_pblk, |
583 | map.m_pblk + map.m_len - 1, ino); |
584 | - err = -EFSCORRUPTED; |
585 | + } |
586 | break; |
587 | } |
588 | - err = add_system_zone(sbi, map.m_pblk, n); |
589 | - if (err < 0) |
590 | - break; |
591 | i += n; |
592 | } |
593 | } |
594 | @@ -201,16 +194,16 @@ int ext4_setup_system_zone(struct super_block *sb) |
595 | if (ext4_bg_has_super(sb, i) && |
596 | ((i < 5) || ((i % flex_size) == 0))) |
597 | add_system_zone(sbi, ext4_group_first_block_no(sb, i), |
598 | - ext4_bg_num_gdb(sb, i) + 1); |
599 | + ext4_bg_num_gdb(sb, i) + 1, 0); |
600 | gdp = ext4_get_group_desc(sb, i, NULL); |
601 | - ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1); |
602 | + ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1, 0); |
603 | if (ret) |
604 | return ret; |
605 | - ret = add_system_zone(sbi, ext4_inode_bitmap(sb, gdp), 1); |
606 | + ret = add_system_zone(sbi, ext4_inode_bitmap(sb, gdp), 1, 0); |
607 | if (ret) |
608 | return ret; |
609 | ret = add_system_zone(sbi, ext4_inode_table(sb, gdp), |
610 | - sbi->s_itb_per_group); |
611 | + sbi->s_itb_per_group, 0); |
612 | if (ret) |
613 | return ret; |
614 | } |
615 | @@ -243,10 +236,11 @@ void ext4_release_system_zone(struct super_block *sb) |
616 | * start_blk+count) is valid; 0 if some part of the block region |
617 | * overlaps with filesystem metadata blocks. |
618 | */ |
619 | -int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, |
620 | - unsigned int count) |
621 | +int ext4_inode_block_valid(struct inode *inode, ext4_fsblk_t start_blk, |
622 | + unsigned int count) |
623 | { |
624 | struct ext4_system_zone *entry; |
625 | + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
626 | struct rb_node *n = sbi->system_blks.rb_node; |
627 | |
628 | if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || |
629 | @@ -262,6 +256,8 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, |
630 | else if (start_blk >= (entry->start_blk + entry->count)) |
631 | n = n->rb_right; |
632 | else { |
633 | + if (entry->ino == inode->i_ino) |
634 | + return 1; |
635 | sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); |
636 | return 0; |
637 | } |
638 | @@ -284,8 +280,7 @@ int ext4_check_blockref(const char *function, unsigned int line, |
639 | while (bref < p+max) { |
640 | blk = le32_to_cpu(*bref++); |
641 | if (blk && |
642 | - unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), |
643 | - blk, 1))) { |
644 | + unlikely(!ext4_inode_block_valid(inode, blk, 1))) { |
645 | es->s_last_error_block = cpu_to_le64(blk); |
646 | ext4_error_inode(inode, function, line, blk, |
647 | "invalid block"); |
648 | diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
649 | index 54a7f3b8b1bf3..1b62bd9e73125 100644 |
650 | --- a/fs/ext4/ext4.h |
651 | +++ b/fs/ext4/ext4.h |
652 | @@ -3136,9 +3136,9 @@ extern void ext4_release_system_zone(struct super_block *sb); |
653 | extern int ext4_setup_system_zone(struct super_block *sb); |
654 | extern int __init ext4_init_system_zone(void); |
655 | extern void ext4_exit_system_zone(void); |
656 | -extern int ext4_data_block_valid(struct ext4_sb_info *sbi, |
657 | - ext4_fsblk_t start_blk, |
658 | - unsigned int count); |
659 | +extern int ext4_inode_block_valid(struct inode *inode, |
660 | + ext4_fsblk_t start_blk, |
661 | + unsigned int count); |
662 | extern int ext4_check_blockref(const char *, unsigned int, |
663 | struct inode *, __le32 *, unsigned int); |
664 | |
665 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
666 | index ab19f61bd04bc..7f291b7be7f3a 100644 |
667 | --- a/fs/ext4/extents.c |
668 | +++ b/fs/ext4/extents.c |
669 | @@ -389,7 +389,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) |
670 | */ |
671 | if (lblock + len <= lblock) |
672 | return 0; |
673 | - return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); |
674 | + return ext4_inode_block_valid(inode, block, len); |
675 | } |
676 | |
677 | static int ext4_valid_extent_idx(struct inode *inode, |
678 | @@ -397,7 +397,7 @@ static int ext4_valid_extent_idx(struct inode *inode, |
679 | { |
680 | ext4_fsblk_t block = ext4_idx_pblock(ext_idx); |
681 | |
682 | - return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, 1); |
683 | + return ext4_inode_block_valid(inode, block, 1); |
684 | } |
685 | |
686 | static int ext4_valid_extent_entries(struct inode *inode, |
687 | @@ -554,14 +554,10 @@ __read_extent_tree_block(const char *function, unsigned int line, |
688 | } |
689 | if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE)) |
690 | return bh; |
691 | - if (!ext4_has_feature_journal(inode->i_sb) || |
692 | - (inode->i_ino != |
693 | - le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) { |
694 | - err = __ext4_ext_check(function, line, inode, |
695 | - ext_block_hdr(bh), depth, pblk); |
696 | - if (err) |
697 | - goto errout; |
698 | - } |
699 | + err = __ext4_ext_check(function, line, inode, |
700 | + ext_block_hdr(bh), depth, pblk); |
701 | + if (err) |
702 | + goto errout; |
703 | set_buffer_verified(bh); |
704 | /* |
705 | * If this is a leaf block, cache all of its entries |
706 | diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c |
707 | index d2844fe9040dd..ff7e1ac6ee530 100644 |
708 | --- a/fs/ext4/indirect.c |
709 | +++ b/fs/ext4/indirect.c |
710 | @@ -840,8 +840,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode, |
711 | else if (ext4_should_journal_data(inode)) |
712 | flags |= EXT4_FREE_BLOCKS_FORGET; |
713 | |
714 | - if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free, |
715 | - count)) { |
716 | + if (!ext4_inode_block_valid(inode, block_to_free, count)) { |
717 | EXT4_ERROR_INODE(inode, "attempt to clear invalid " |
718 | "blocks %llu len %lu", |
719 | (unsigned long long) block_to_free, count); |
720 | @@ -1003,8 +1002,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, |
721 | if (!nr) |
722 | continue; /* A hole */ |
723 | |
724 | - if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), |
725 | - nr, 1)) { |
726 | + if (!ext4_inode_block_valid(inode, nr, 1)) { |
727 | EXT4_ERROR_INODE(inode, |
728 | "invalid indirect mapped " |
729 | "block %lu (level %d)", |
730 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
731 | index ccce89de6d7e3..aa97a3ed3d8f7 100644 |
732 | --- a/fs/ext4/inode.c |
733 | +++ b/fs/ext4/inode.c |
734 | @@ -378,8 +378,7 @@ static int __check_block_validity(struct inode *inode, const char *func, |
735 | (inode->i_ino == |
736 | le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) |
737 | return 0; |
738 | - if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, |
739 | - map->m_len)) { |
740 | + if (!ext4_inode_block_valid(inode, map->m_pblk, map->m_len)) { |
741 | ext4_error_inode(inode, func, line, map->m_pblk, |
742 | "lblock %lu mapped to illegal pblock %llu " |
743 | "(length %d)", (unsigned long) map->m_lblk, |
744 | @@ -4704,7 +4703,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
745 | |
746 | ret = 0; |
747 | if (ei->i_file_acl && |
748 | - !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { |
749 | + !ext4_inode_block_valid(inode, ei->i_file_acl, 1)) { |
750 | ext4_error_inode(inode, function, line, 0, |
751 | "iget: bad extended attribute block %llu", |
752 | ei->i_file_acl); |
753 | @@ -4894,7 +4893,7 @@ static int ext4_do_update_inode(handle_t *handle, |
754 | struct ext4_inode_info *ei = EXT4_I(inode); |
755 | struct buffer_head *bh = iloc->bh; |
756 | struct super_block *sb = inode->i_sb; |
757 | - int err = 0, rc, block; |
758 | + int err = 0, block; |
759 | int need_datasync = 0, set_large_file = 0; |
760 | uid_t i_uid; |
761 | gid_t i_gid; |
762 | @@ -5004,9 +5003,9 @@ static int ext4_do_update_inode(handle_t *handle, |
763 | bh->b_data); |
764 | |
765 | BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); |
766 | - rc = ext4_handle_dirty_metadata(handle, NULL, bh); |
767 | - if (!err) |
768 | - err = rc; |
769 | + err = ext4_handle_dirty_metadata(handle, NULL, bh); |
770 | + if (err) |
771 | + goto out_brelse; |
772 | ext4_clear_inode_state(inode, EXT4_STATE_NEW); |
773 | if (set_large_file) { |
774 | BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access"); |
775 | diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
776 | index 1d543f8b3814f..807331da9dfc1 100644 |
777 | --- a/fs/ext4/mballoc.c |
778 | +++ b/fs/ext4/mballoc.c |
779 | @@ -2963,7 +2963,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, |
780 | block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); |
781 | |
782 | len = EXT4_C2B(sbi, ac->ac_b_ex.fe_len); |
783 | - if (!ext4_data_block_valid(sbi, block, len)) { |
784 | + if (!ext4_inode_block_valid(ac->ac_inode, block, len)) { |
785 | ext4_error(sb, "Allocating blocks %llu-%llu which overlap " |
786 | "fs metadata", block, block+len); |
787 | /* File system mounted not to panic on error |
788 | @@ -4725,7 +4725,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, |
789 | |
790 | sbi = EXT4_SB(sb); |
791 | if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) && |
792 | - !ext4_data_block_valid(sbi, block, count)) { |
793 | + !ext4_inode_block_valid(inode, block, count)) { |
794 | ext4_error(sb, "Freeing blocks not in datazone - " |
795 | "block = %llu, count = %lu", block, count); |
796 | goto error_return; |
797 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
798 | index 6224b0e6fb643..e6e3eb8dd4d6c 100644 |
799 | --- a/fs/ext4/namei.c |
800 | +++ b/fs/ext4/namei.c |
801 | @@ -3425,6 +3425,31 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent, |
802 | return 0; |
803 | } |
804 | |
805 | +static void ext4_resetent(handle_t *handle, struct ext4_renament *ent, |
806 | + unsigned ino, unsigned file_type) |
807 | +{ |
808 | + struct ext4_renament old = *ent; |
809 | + int retval = 0; |
810 | + |
811 | + /* |
812 | + * old->de could have moved from under us during make indexed dir, |
813 | + * so the old->de may no longer valid and need to find it again |
814 | + * before reset old inode info. |
815 | + */ |
816 | + old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); |
817 | + if (IS_ERR(old.bh)) |
818 | + retval = PTR_ERR(old.bh); |
819 | + if (!old.bh) |
820 | + retval = -ENOENT; |
821 | + if (retval) { |
822 | + ext4_std_error(old.dir->i_sb, retval); |
823 | + return; |
824 | + } |
825 | + |
826 | + ext4_setent(handle, &old, ino, file_type); |
827 | + brelse(old.bh); |
828 | +} |
829 | + |
830 | static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, |
831 | const struct qstr *d_name) |
832 | { |
833 | @@ -3734,8 +3759,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, |
834 | end_rename: |
835 | if (whiteout) { |
836 | if (retval) { |
837 | - ext4_setent(handle, &old, |
838 | - old.inode->i_ino, old_file_type); |
839 | + ext4_resetent(handle, &old, |
840 | + old.inode->i_ino, old_file_type); |
841 | drop_nlink(whiteout); |
842 | } |
843 | unlock_new_inode(whiteout); |
844 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
845 | index 84d28d3efc602..f70c5541d718d 100644 |
846 | --- a/fs/ext4/super.c |
847 | +++ b/fs/ext4/super.c |
848 | @@ -5148,7 +5148,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
849 | ext4_register_li_request(sb, first_not_zeroed); |
850 | } |
851 | |
852 | - ext4_setup_system_zone(sb); |
853 | + err = ext4_setup_system_zone(sb); |
854 | + if (err) |
855 | + goto restore_opts; |
856 | + |
857 | if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) |
858 | ext4_commit_super(sb, 1); |
859 | |
860 | diff --git a/fs/select.c b/fs/select.c |
861 | index 3d4f85defeab0..de675c79f479d 100644 |
862 | --- a/fs/select.c |
863 | +++ b/fs/select.c |
864 | @@ -961,10 +961,9 @@ static long do_restart_poll(struct restart_block *restart_block) |
865 | |
866 | ret = do_sys_poll(ufds, nfds, to); |
867 | |
868 | - if (ret == -EINTR) { |
869 | - restart_block->fn = do_restart_poll; |
870 | - ret = -ERESTART_RESTARTBLOCK; |
871 | - } |
872 | + if (ret == -EINTR) |
873 | + ret = set_restart_fn(restart_block, do_restart_poll); |
874 | + |
875 | return ret; |
876 | } |
877 | |
878 | @@ -986,7 +985,6 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, |
879 | struct restart_block *restart_block; |
880 | |
881 | restart_block = ¤t->restart_block; |
882 | - restart_block->fn = do_restart_poll; |
883 | restart_block->poll.ufds = ufds; |
884 | restart_block->poll.nfds = nfds; |
885 | |
886 | @@ -997,7 +995,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, |
887 | } else |
888 | restart_block->poll.has_timeout = 0; |
889 | |
890 | - ret = -ERESTART_RESTARTBLOCK; |
891 | + ret = set_restart_fn(restart_block, do_restart_poll); |
892 | } |
893 | return ret; |
894 | } |
895 | diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h |
896 | index 5e6436741f968..330794252270d 100644 |
897 | --- a/include/linux/thread_info.h |
898 | +++ b/include/linux/thread_info.h |
899 | @@ -9,6 +9,7 @@ |
900 | |
901 | #include <linux/types.h> |
902 | #include <linux/bug.h> |
903 | +#include <linux/errno.h> |
904 | |
905 | struct timespec; |
906 | struct compat_timespec; |
907 | @@ -59,6 +60,18 @@ extern long do_no_restart_syscall(struct restart_block *parm); |
908 | |
909 | #ifdef __KERNEL__ |
910 | |
911 | +#ifndef arch_set_restart_data |
912 | +#define arch_set_restart_data(restart) do { } while (0) |
913 | +#endif |
914 | + |
915 | +static inline long set_restart_fn(struct restart_block *restart, |
916 | + long (*fn)(struct restart_block *)) |
917 | +{ |
918 | + restart->fn = fn; |
919 | + arch_set_restart_data(restart); |
920 | + return -ERESTART_RESTARTBLOCK; |
921 | +} |
922 | + |
923 | #define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_NOTRACK | __GFP_ZERO) |
924 | |
925 | /* |
926 | diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h |
927 | index 33c603dd7cd30..8e0e6d3091f19 100644 |
928 | --- a/include/uapi/linux/usb/ch9.h |
929 | +++ b/include/uapi/linux/usb/ch9.h |
930 | @@ -358,6 +358,9 @@ struct usb_config_descriptor { |
931 | |
932 | /*-------------------------------------------------------------------------*/ |
933 | |
934 | +/* USB String descriptors can contain at most 126 characters. */ |
935 | +#define USB_MAX_STRING_LEN 126 |
936 | + |
937 | /* USB_DT_STRING: String descriptor */ |
938 | struct usb_string_descriptor { |
939 | __u8 bLength; |
940 | diff --git a/kernel/futex.c b/kernel/futex.c |
941 | index 0015c14ac2c04..796b1c8608397 100644 |
942 | --- a/kernel/futex.c |
943 | +++ b/kernel/futex.c |
944 | @@ -2822,14 +2822,13 @@ retry: |
945 | goto out; |
946 | |
947 | restart = ¤t->restart_block; |
948 | - restart->fn = futex_wait_restart; |
949 | restart->futex.uaddr = uaddr; |
950 | restart->futex.val = val; |
951 | restart->futex.time = abs_time->tv64; |
952 | restart->futex.bitset = bitset; |
953 | restart->futex.flags = flags | FLAGS_HAS_TIMEOUT; |
954 | |
955 | - ret = -ERESTART_RESTARTBLOCK; |
956 | + ret = set_restart_fn(restart, futex_wait_restart); |
957 | |
958 | out: |
959 | if (to) { |
960 | diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
961 | index b2fc2a581b861..33770ef64d219 100644 |
962 | --- a/kernel/irq/manage.c |
963 | +++ b/kernel/irq/manage.c |
964 | @@ -886,11 +886,15 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action) |
965 | irqreturn_t ret; |
966 | |
967 | local_bh_disable(); |
968 | + if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE)) |
969 | + local_irq_disable(); |
970 | ret = action->thread_fn(action->irq, action->dev_id); |
971 | if (ret == IRQ_HANDLED) |
972 | atomic_inc(&desc->threads_handled); |
973 | |
974 | irq_finalize_oneshot(desc, action); |
975 | + if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE)) |
976 | + local_irq_enable(); |
977 | local_bh_enable(); |
978 | return ret; |
979 | } |
980 | diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c |
981 | index 6aef4a0bed29e..d06c1d8dd4d27 100644 |
982 | --- a/kernel/time/alarmtimer.c |
983 | +++ b/kernel/time/alarmtimer.c |
984 | @@ -809,10 +809,10 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags, |
985 | } |
986 | |
987 | restart = ¤t->restart_block; |
988 | - restart->fn = alarm_timer_nsleep_restart; |
989 | restart->nanosleep.clockid = type; |
990 | restart->nanosleep.expires = exp.tv64; |
991 | restart->nanosleep.rmtp = rmtp; |
992 | + set_restart_fn(restart, alarm_timer_nsleep_restart); |
993 | ret = -ERESTART_RESTARTBLOCK; |
994 | |
995 | out: |
996 | diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c |
997 | index f31637ced7fac..df7750e032425 100644 |
998 | --- a/kernel/time/hrtimer.c |
999 | +++ b/kernel/time/hrtimer.c |
1000 | @@ -1582,10 +1582,10 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, |
1001 | } |
1002 | |
1003 | restart = ¤t->restart_block; |
1004 | - restart->fn = hrtimer_nanosleep_restart; |
1005 | restart->nanosleep.clockid = t.timer.base->clockid; |
1006 | restart->nanosleep.rmtp = rmtp; |
1007 | restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer); |
1008 | + set_restart_fn(restart, hrtimer_nanosleep_restart); |
1009 | |
1010 | ret = -ERESTART_RESTARTBLOCK; |
1011 | out: |
1012 | diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c |
1013 | index 21a27bb735870..9fff077d0ffc4 100644 |
1014 | --- a/kernel/time/posix-cpu-timers.c |
1015 | +++ b/kernel/time/posix-cpu-timers.c |
1016 | @@ -1377,10 +1377,10 @@ static int posix_cpu_nsleep(const clockid_t which_clock, int flags, |
1017 | if (rmtp && copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) |
1018 | return -EFAULT; |
1019 | |
1020 | - restart_block->fn = posix_cpu_nsleep_restart; |
1021 | restart_block->nanosleep.clockid = which_clock; |
1022 | restart_block->nanosleep.rmtp = rmtp; |
1023 | restart_block->nanosleep.expires = timespec_to_ns(rqtp); |
1024 | + set_restart_fn(restart_block, posix_cpu_nsleep_restart); |
1025 | } |
1026 | return error; |
1027 | } |
1028 | diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c |
1029 | index a8253079902fb..d62b7a7f65bb0 100644 |
1030 | --- a/net/qrtr/qrtr.c |
1031 | +++ b/net/qrtr/qrtr.c |
1032 | @@ -232,7 +232,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) |
1033 | if (dst != QRTR_PORT_CTRL && type != QRTR_TYPE_DATA) |
1034 | return -EINVAL; |
1035 | |
1036 | - skb = netdev_alloc_skb(NULL, len); |
1037 | + skb = __netdev_alloc_skb(NULL, len, GFP_ATOMIC | __GFP_NOWARN); |
1038 | if (!skb) |
1039 | return -ENOMEM; |
1040 | |
1041 | diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c |
1042 | index eea18a124e4f7..ab6b7852a11cf 100644 |
1043 | --- a/net/sunrpc/svc.c |
1044 | +++ b/net/sunrpc/svc.c |
1045 | @@ -1306,7 +1306,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) |
1046 | |
1047 | sendit: |
1048 | if (svc_authorise(rqstp)) |
1049 | - goto close; |
1050 | + goto close_xprt; |
1051 | return 1; /* Caller can now send it */ |
1052 | |
1053 | dropit: |
1054 | @@ -1315,6 +1315,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) |
1055 | return 0; |
1056 | |
1057 | close: |
1058 | + svc_authorise(rqstp); |
1059 | +close_xprt: |
1060 | if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) |
1061 | svc_close_xprt(rqstp->rq_xprt); |
1062 | dprintk("svc: svc_process close\n"); |
1063 | @@ -1323,7 +1325,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) |
1064 | err_short_len: |
1065 | svc_printk(rqstp, "short len %Zd, dropping request\n", |
1066 | argv->iov_len); |
1067 | - goto close; |
1068 | + goto close_xprt; |
1069 | |
1070 | err_bad_rpc: |
1071 | serv->sv_stats->rpcbadfmt++; |
1072 | diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c |
1073 | index 56e4ac8e2e994..7d366f6bef863 100644 |
1074 | --- a/net/sunrpc/svc_xprt.c |
1075 | +++ b/net/sunrpc/svc_xprt.c |
1076 | @@ -1104,7 +1104,7 @@ static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, st |
1077 | struct svc_xprt *xprt; |
1078 | int ret = 0; |
1079 | |
1080 | - spin_lock(&serv->sv_lock); |
1081 | + spin_lock_bh(&serv->sv_lock); |
1082 | list_for_each_entry(xprt, xprt_list, xpt_list) { |
1083 | if (xprt->xpt_net != net) |
1084 | continue; |
1085 | @@ -1112,7 +1112,7 @@ static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, st |
1086 | set_bit(XPT_CLOSE, &xprt->xpt_flags); |
1087 | svc_xprt_enqueue(xprt); |
1088 | } |
1089 | - spin_unlock(&serv->sv_lock); |
1090 | + spin_unlock_bh(&serv->sv_lock); |
1091 | return ret; |
1092 | } |
1093 | |
1094 | diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
1095 | index b3d48c6243c80..791072cd94920 100644 |
1096 | --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
1097 | +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c |
1098 | @@ -328,9 +328,9 @@ xprt_setup_rdma_bc(struct xprt_create *args) |
1099 | xprt->timeout = &xprt_rdma_bc_timeout; |
1100 | xprt_set_bound(xprt); |
1101 | xprt_set_connected(xprt); |
1102 | - xprt->bind_timeout = RPCRDMA_BIND_TO; |
1103 | - xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO; |
1104 | - xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO; |
1105 | + xprt->bind_timeout = 0; |
1106 | + xprt->reestablish_timeout = 0; |
1107 | + xprt->idle_timeout = 0; |
1108 | |
1109 | xprt->prot = XPRT_TRANSPORT_BC_RDMA; |
1110 | xprt->tsh_size = RPCRDMA_HDRLEN_MIN / sizeof(__be32); |