Contents of /trunk/kernel-alx-legacy/patches-4.9/0424-4.9.325-all-fixes.patch
Parent Directory | Revision Log
Revision 3726 -
(show annotations)
(download)
Mon Oct 24 14:08:37 2022 UTC (18 months ago) by niro
File size: 40021 byte(s)
Mon Oct 24 14:08:37 2022 UTC (18 months ago) by niro
File size: 40021 byte(s)
-linux-4.9.325
1 | diff --git a/Makefile b/Makefile |
2 | index 3168f1c122213..6042ded263475 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 324 |
9 | +SUBLEVEL = 325 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c |
14 | index 72b59511e59aa..bfeafff14c092 100644 |
15 | --- a/arch/alpha/kernel/srmcons.c |
16 | +++ b/arch/alpha/kernel/srmcons.c |
17 | @@ -58,7 +58,7 @@ srmcons_do_receive_chars(struct tty_port *port) |
18 | } while((result.bits.status & 1) && (++loops < 10)); |
19 | |
20 | if (count) |
21 | - tty_schedule_flip(port); |
22 | + tty_flip_buffer_push(port); |
23 | |
24 | return count; |
25 | } |
26 | diff --git a/drivers/char/random.c b/drivers/char/random.c |
27 | index 38591c53ea571..1cbc33ee5a5f2 100644 |
28 | --- a/drivers/char/random.c |
29 | +++ b/drivers/char/random.c |
30 | @@ -184,8 +184,8 @@ static void __cold process_random_ready_list(void) |
31 | |
32 | #define warn_unseeded_randomness() \ |
33 | if (IS_ENABLED(CONFIG_WARN_ALL_UNSEEDED_RANDOM) && !crng_ready()) \ |
34 | - pr_notice("%s called from %pS with crng_init=%d\n", \ |
35 | - __func__, (void *)_RET_IP_, crng_init) |
36 | + printk_deferred(KERN_NOTICE "random: %s called from %pS with crng_init=%d\n", \ |
37 | + __func__, (void *)_RET_IP_, crng_init) |
38 | |
39 | |
40 | /********************************************************************* |
41 | diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c |
42 | index 9ab056bb834d9..fce1906e7df18 100644 |
43 | --- a/drivers/i2c/busses/i2c-cadence.c |
44 | +++ b/drivers/i2c/busses/i2c-cadence.c |
45 | @@ -203,9 +203,9 @@ static inline bool cdns_is_holdquirk(struct cdns_i2c *id, bool hold_wrkaround) |
46 | */ |
47 | static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
48 | { |
49 | - unsigned int isr_status, avail_bytes, updatetx; |
50 | + unsigned int isr_status, avail_bytes; |
51 | unsigned int bytes_to_send; |
52 | - bool hold_quirk; |
53 | + bool updatetx; |
54 | struct cdns_i2c *id = ptr; |
55 | /* Signal completion only after everything is updated */ |
56 | int done_flag = 0; |
57 | @@ -224,11 +224,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
58 | * Check if transfer size register needs to be updated again for a |
59 | * large data receive operation. |
60 | */ |
61 | - updatetx = 0; |
62 | - if (id->recv_count > id->curr_recv_count) |
63 | - updatetx = 1; |
64 | - |
65 | - hold_quirk = (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) && updatetx; |
66 | + updatetx = id->recv_count > id->curr_recv_count; |
67 | |
68 | /* When receiving, handle data interrupt and completion interrupt */ |
69 | if (id->p_recv_buf && |
70 | @@ -251,7 +247,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
71 | id->recv_count--; |
72 | id->curr_recv_count--; |
73 | |
74 | - if (cdns_is_holdquirk(id, hold_quirk)) |
75 | + if (cdns_is_holdquirk(id, updatetx)) |
76 | break; |
77 | } |
78 | |
79 | @@ -262,7 +258,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
80 | * maintain transfer size non-zero while performing a large |
81 | * receive operation. |
82 | */ |
83 | - if (cdns_is_holdquirk(id, hold_quirk)) { |
84 | + if (cdns_is_holdquirk(id, updatetx)) { |
85 | /* wait while fifo is full */ |
86 | while (cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET) != |
87 | (id->curr_recv_count - CDNS_I2C_FIFO_DEPTH)) |
88 | @@ -284,22 +280,6 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
89 | CDNS_I2C_XFER_SIZE_OFFSET); |
90 | id->curr_recv_count = id->recv_count; |
91 | } |
92 | - } else if (id->recv_count && !hold_quirk && |
93 | - !id->curr_recv_count) { |
94 | - |
95 | - /* Set the slave address in address register*/ |
96 | - cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK, |
97 | - CDNS_I2C_ADDR_OFFSET); |
98 | - |
99 | - if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) { |
100 | - cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE, |
101 | - CDNS_I2C_XFER_SIZE_OFFSET); |
102 | - id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE; |
103 | - } else { |
104 | - cdns_i2c_writereg(id->recv_count, |
105 | - CDNS_I2C_XFER_SIZE_OFFSET); |
106 | - id->curr_recv_count = id->recv_count; |
107 | - } |
108 | } |
109 | |
110 | /* Clear hold (if not repeated start) and signal completion */ |
111 | diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c |
112 | index e94f855eac155..fd859a7872a6d 100644 |
113 | --- a/drivers/mfd/rtsx_usb.c |
114 | +++ b/drivers/mfd/rtsx_usb.c |
115 | @@ -642,16 +642,20 @@ static int rtsx_usb_probe(struct usb_interface *intf, |
116 | |
117 | ucr->pusb_dev = usb_dev; |
118 | |
119 | - ucr->iobuf = usb_alloc_coherent(ucr->pusb_dev, IOBUF_SIZE, |
120 | - GFP_KERNEL, &ucr->iobuf_dma); |
121 | - if (!ucr->iobuf) |
122 | + ucr->cmd_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL); |
123 | + if (!ucr->cmd_buf) |
124 | return -ENOMEM; |
125 | |
126 | + ucr->rsp_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL); |
127 | + if (!ucr->rsp_buf) { |
128 | + ret = -ENOMEM; |
129 | + goto out_free_cmd_buf; |
130 | + } |
131 | + |
132 | usb_set_intfdata(intf, ucr); |
133 | |
134 | ucr->vendor_id = id->idVendor; |
135 | ucr->product_id = id->idProduct; |
136 | - ucr->cmd_buf = ucr->rsp_buf = ucr->iobuf; |
137 | |
138 | mutex_init(&ucr->dev_mutex); |
139 | |
140 | @@ -679,8 +683,11 @@ static int rtsx_usb_probe(struct usb_interface *intf, |
141 | |
142 | out_init_fail: |
143 | usb_set_intfdata(ucr->pusb_intf, NULL); |
144 | - usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf, |
145 | - ucr->iobuf_dma); |
146 | + kfree(ucr->rsp_buf); |
147 | + ucr->rsp_buf = NULL; |
148 | +out_free_cmd_buf: |
149 | + kfree(ucr->cmd_buf); |
150 | + ucr->cmd_buf = NULL; |
151 | return ret; |
152 | } |
153 | |
154 | @@ -693,8 +700,12 @@ static void rtsx_usb_disconnect(struct usb_interface *intf) |
155 | mfd_remove_devices(&intf->dev); |
156 | |
157 | usb_set_intfdata(ucr->pusb_intf, NULL); |
158 | - usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf, |
159 | - ucr->iobuf_dma); |
160 | + |
161 | + kfree(ucr->cmd_buf); |
162 | + ucr->cmd_buf = NULL; |
163 | + |
164 | + kfree(ucr->rsp_buf); |
165 | + ucr->rsp_buf = NULL; |
166 | } |
167 | |
168 | #ifdef CONFIG_PM |
169 | diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c |
170 | index 8887dd3abed71..619cc13ffb550 100644 |
171 | --- a/drivers/net/ethernet/emulex/benet/be_cmds.c |
172 | +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c |
173 | @@ -2291,7 +2291,7 @@ err: |
174 | |
175 | /* Uses sync mcc */ |
176 | int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, |
177 | - u8 page_num, u8 *data) |
178 | + u8 page_num, u32 off, u32 len, u8 *data) |
179 | { |
180 | struct be_dma_mem cmd; |
181 | struct be_mcc_wrb *wrb; |
182 | @@ -2325,10 +2325,10 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, |
183 | req->port = cpu_to_le32(adapter->hba_port_num); |
184 | req->page_num = cpu_to_le32(page_num); |
185 | status = be_mcc_notify_wait(adapter); |
186 | - if (!status) { |
187 | + if (!status && len > 0) { |
188 | struct be_cmd_resp_port_type *resp = cmd.va; |
189 | |
190 | - memcpy(data, resp->page_data, PAGE_DATA_LEN); |
191 | + memcpy(data, resp->page_data + off, len); |
192 | } |
193 | err: |
194 | mutex_unlock(&adapter->mcc_lock); |
195 | @@ -2419,7 +2419,7 @@ int be_cmd_query_cable_type(struct be_adapter *adapter) |
196 | int status; |
197 | |
198 | status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
199 | - page_data); |
200 | + 0, PAGE_DATA_LEN, page_data); |
201 | if (!status) { |
202 | switch (adapter->phy.interface_type) { |
203 | case PHY_TYPE_QSFP: |
204 | @@ -2444,7 +2444,7 @@ int be_cmd_query_sfp_info(struct be_adapter *adapter) |
205 | int status; |
206 | |
207 | status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
208 | - page_data); |
209 | + 0, PAGE_DATA_LEN, page_data); |
210 | if (!status) { |
211 | strlcpy(adapter->phy.vendor_name, page_data + |
212 | SFP_VENDOR_NAME_OFFSET, SFP_VENDOR_NAME_LEN - 1); |
213 | diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h |
214 | index 09da2d82c2f0d..8af11a5e49fe2 100644 |
215 | --- a/drivers/net/ethernet/emulex/benet/be_cmds.h |
216 | +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h |
217 | @@ -2431,7 +2431,7 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon, |
218 | int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, |
219 | u32 *state); |
220 | int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, |
221 | - u8 page_num, u8 *data); |
222 | + u8 page_num, u32 off, u32 len, u8 *data); |
223 | int be_cmd_query_cable_type(struct be_adapter *adapter); |
224 | int be_cmd_query_sfp_info(struct be_adapter *adapter); |
225 | int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, |
226 | diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c |
227 | index 56db37d929374..ca7750f483f98 100644 |
228 | --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c |
229 | +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c |
230 | @@ -1345,7 +1345,7 @@ static int be_get_module_info(struct net_device *netdev, |
231 | return -EOPNOTSUPP; |
232 | |
233 | status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
234 | - page_data); |
235 | + 0, PAGE_DATA_LEN, page_data); |
236 | if (!status) { |
237 | if (!page_data[SFP_PLUS_SFF_8472_COMP]) { |
238 | modinfo->type = ETH_MODULE_SFF_8079; |
239 | @@ -1363,25 +1363,32 @@ static int be_get_module_eeprom(struct net_device *netdev, |
240 | { |
241 | struct be_adapter *adapter = netdev_priv(netdev); |
242 | int status; |
243 | + u32 begin, end; |
244 | |
245 | if (!check_privilege(adapter, MAX_PRIVILEGES)) |
246 | return -EOPNOTSUPP; |
247 | |
248 | - status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
249 | - data); |
250 | - if (status) |
251 | - goto err; |
252 | + begin = eeprom->offset; |
253 | + end = eeprom->offset + eeprom->len; |
254 | + |
255 | + if (begin < PAGE_DATA_LEN) { |
256 | + status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, begin, |
257 | + min_t(u32, end, PAGE_DATA_LEN) - begin, |
258 | + data); |
259 | + if (status) |
260 | + goto err; |
261 | + |
262 | + data += PAGE_DATA_LEN - begin; |
263 | + begin = PAGE_DATA_LEN; |
264 | + } |
265 | |
266 | - if (eeprom->offset + eeprom->len > PAGE_DATA_LEN) { |
267 | - status = be_cmd_read_port_transceiver_data(adapter, |
268 | - TR_PAGE_A2, |
269 | - data + |
270 | - PAGE_DATA_LEN); |
271 | + if (end > PAGE_DATA_LEN) { |
272 | + status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A2, |
273 | + begin - PAGE_DATA_LEN, |
274 | + end - begin, data); |
275 | if (status) |
276 | goto err; |
277 | } |
278 | - if (eeprom->offset) |
279 | - memcpy(data, data + eeprom->offset, eeprom->len); |
280 | err: |
281 | return be_cmd_status(status); |
282 | } |
283 | diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c |
284 | index 48938d00ff7e8..460a0294ea97e 100644 |
285 | --- a/drivers/net/usb/ax88179_178a.c |
286 | +++ b/drivers/net/usb/ax88179_178a.c |
287 | @@ -1703,7 +1703,7 @@ static const struct driver_info ax88179_info = { |
288 | .link_reset = ax88179_link_reset, |
289 | .reset = ax88179_reset, |
290 | .stop = ax88179_stop, |
291 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
292 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
293 | .rx_fixup = ax88179_rx_fixup, |
294 | .tx_fixup = ax88179_tx_fixup, |
295 | }; |
296 | @@ -1716,7 +1716,7 @@ static const struct driver_info ax88178a_info = { |
297 | .link_reset = ax88179_link_reset, |
298 | .reset = ax88179_reset, |
299 | .stop = ax88179_stop, |
300 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
301 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
302 | .rx_fixup = ax88179_rx_fixup, |
303 | .tx_fixup = ax88179_tx_fixup, |
304 | }; |
305 | @@ -1729,7 +1729,7 @@ static const struct driver_info cypress_GX3_info = { |
306 | .link_reset = ax88179_link_reset, |
307 | .reset = ax88179_reset, |
308 | .stop = ax88179_stop, |
309 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
310 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
311 | .rx_fixup = ax88179_rx_fixup, |
312 | .tx_fixup = ax88179_tx_fixup, |
313 | }; |
314 | @@ -1742,7 +1742,7 @@ static const struct driver_info dlink_dub1312_info = { |
315 | .link_reset = ax88179_link_reset, |
316 | .reset = ax88179_reset, |
317 | .stop = ax88179_stop, |
318 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
319 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
320 | .rx_fixup = ax88179_rx_fixup, |
321 | .tx_fixup = ax88179_tx_fixup, |
322 | }; |
323 | @@ -1755,7 +1755,7 @@ static const struct driver_info sitecom_info = { |
324 | .link_reset = ax88179_link_reset, |
325 | .reset = ax88179_reset, |
326 | .stop = ax88179_stop, |
327 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
328 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
329 | .rx_fixup = ax88179_rx_fixup, |
330 | .tx_fixup = ax88179_tx_fixup, |
331 | }; |
332 | @@ -1768,7 +1768,7 @@ static const struct driver_info samsung_info = { |
333 | .link_reset = ax88179_link_reset, |
334 | .reset = ax88179_reset, |
335 | .stop = ax88179_stop, |
336 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
337 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
338 | .rx_fixup = ax88179_rx_fixup, |
339 | .tx_fixup = ax88179_tx_fixup, |
340 | }; |
341 | @@ -1781,7 +1781,7 @@ static const struct driver_info lenovo_info = { |
342 | .link_reset = ax88179_link_reset, |
343 | .reset = ax88179_reset, |
344 | .stop = ax88179_stop, |
345 | - .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
346 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
347 | .rx_fixup = ax88179_rx_fixup, |
348 | .tx_fixup = ax88179_tx_fixup, |
349 | }; |
350 | diff --git a/drivers/power/reset/arm-versatile-reboot.c b/drivers/power/reset/arm-versatile-reboot.c |
351 | index 06d34ab47df53..8022c782f6ff3 100644 |
352 | --- a/drivers/power/reset/arm-versatile-reboot.c |
353 | +++ b/drivers/power/reset/arm-versatile-reboot.c |
354 | @@ -150,6 +150,7 @@ static int __init versatile_reboot_probe(void) |
355 | versatile_reboot_type = (enum versatile_reboot)reboot_id->data; |
356 | |
357 | syscon_regmap = syscon_node_to_regmap(np); |
358 | + of_node_put(np); |
359 | if (IS_ERR(syscon_regmap)) |
360 | return PTR_ERR(syscon_regmap); |
361 | |
362 | diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h |
363 | index a31f339211d58..b3172908f18c3 100644 |
364 | --- a/drivers/s390/char/keyboard.h |
365 | +++ b/drivers/s390/char/keyboard.h |
366 | @@ -44,7 +44,7 @@ static inline void |
367 | kbd_put_queue(struct tty_port *port, int ch) |
368 | { |
369 | tty_insert_flip_char(port, ch, 0); |
370 | - tty_schedule_flip(port); |
371 | + tty_flip_buffer_push(port); |
372 | } |
373 | |
374 | static inline void |
375 | @@ -52,5 +52,5 @@ kbd_puts_queue(struct tty_port *port, char *cp) |
376 | { |
377 | while (*cp) |
378 | tty_insert_flip_char(port, *cp++, 0); |
379 | - tty_schedule_flip(port); |
380 | + tty_flip_buffer_push(port); |
381 | } |
382 | diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c |
383 | index 5e4fa92068615..3e1d03a1b8e5a 100644 |
384 | --- a/drivers/tty/cyclades.c |
385 | +++ b/drivers/tty/cyclades.c |
386 | @@ -556,7 +556,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, |
387 | } |
388 | info->idle_stats.recv_idle = jiffies; |
389 | } |
390 | - tty_schedule_flip(port); |
391 | + tty_flip_buffer_push(port); |
392 | |
393 | /* end of service */ |
394 | cyy_writeb(info, CyRIR, save_xir & 0x3f); |
395 | @@ -998,7 +998,7 @@ static void cyz_handle_rx(struct cyclades_port *info) |
396 | jiffies + 1); |
397 | #endif |
398 | info->idle_stats.recv_idle = jiffies; |
399 | - tty_schedule_flip(&info->port); |
400 | + tty_flip_buffer_push(&info->port); |
401 | |
402 | /* Update rx_get */ |
403 | cy_writel(&buf_ctrl->rx_get, new_rx_get); |
404 | @@ -1174,7 +1174,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) |
405 | if (delta_count) |
406 | wake_up_interruptible(&info->port.delta_msr_wait); |
407 | if (special_count) |
408 | - tty_schedule_flip(&info->port); |
409 | + tty_flip_buffer_push(&info->port); |
410 | } |
411 | } |
412 | |
413 | diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c |
414 | index 996bd473dd03e..5c075c3808af1 100644 |
415 | --- a/drivers/tty/goldfish.c |
416 | +++ b/drivers/tty/goldfish.c |
417 | @@ -85,7 +85,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) |
418 | writel(count, base + GOLDFISH_TTY_DATA_LEN); |
419 | writel(GOLDFISH_TTY_CMD_READ_BUFFER, base + GOLDFISH_TTY_CMD); |
420 | spin_unlock_irqrestore(&qtty->lock, irq_flags); |
421 | - tty_schedule_flip(&qtty->port); |
422 | + tty_flip_buffer_push(&qtty->port); |
423 | return IRQ_HANDLED; |
424 | } |
425 | |
426 | diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c |
427 | index 60d37b225589c..0a17abf484d47 100644 |
428 | --- a/drivers/tty/moxa.c |
429 | +++ b/drivers/tty/moxa.c |
430 | @@ -1397,7 +1397,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, |
431 | if (inited && !tty_throttled(tty) && |
432 | MoxaPortRxQueue(p) > 0) { /* RX */ |
433 | MoxaPortReadData(p); |
434 | - tty_schedule_flip(&p->port); |
435 | + tty_flip_buffer_push(&p->port); |
436 | } |
437 | } else { |
438 | clear_bit(EMPTYWAIT, &p->statusflags); |
439 | @@ -1422,7 +1422,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, |
440 | |
441 | if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */ |
442 | tty_insert_flip_char(&p->port, 0, TTY_BREAK); |
443 | - tty_schedule_flip(&p->port); |
444 | + tty_flip_buffer_push(&p->port); |
445 | } |
446 | |
447 | if (intr & IntrLine) |
448 | diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
449 | index 8a063a036bc08..f13f2535cc85b 100644 |
450 | --- a/drivers/tty/pty.c |
451 | +++ b/drivers/tty/pty.c |
452 | @@ -106,21 +106,11 @@ static void pty_unthrottle(struct tty_struct *tty) |
453 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
454 | { |
455 | struct tty_struct *to = tty->link; |
456 | - unsigned long flags; |
457 | |
458 | - if (tty->stopped) |
459 | + if (tty->stopped || !c) |
460 | return 0; |
461 | |
462 | - if (c > 0) { |
463 | - spin_lock_irqsave(&to->port->lock, flags); |
464 | - /* Stuff the data into the input queue of the other end */ |
465 | - c = tty_insert_flip_string(to->port, buf, c); |
466 | - spin_unlock_irqrestore(&to->port->lock, flags); |
467 | - /* And shovel */ |
468 | - if (c) |
469 | - tty_flip_buffer_push(to->port); |
470 | - } |
471 | - return c; |
472 | + return tty_insert_flip_string_and_push_buffer(to->port, buf, c); |
473 | } |
474 | |
475 | /** |
476 | diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c |
477 | index 7eb04ae71cc87..c74b30fa7bea0 100644 |
478 | --- a/drivers/tty/serial/lpc32xx_hs.c |
479 | +++ b/drivers/tty/serial/lpc32xx_hs.c |
480 | @@ -350,7 +350,7 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) |
481 | LPC32XX_HSUART_IIR(port->membase)); |
482 | port->icount.overrun++; |
483 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
484 | - tty_schedule_flip(tport); |
485 | + tty_flip_buffer_push(tport); |
486 | } |
487 | |
488 | /* Data received? */ |
489 | diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c |
490 | index e65faa98146ef..17ccfc33dc3d6 100644 |
491 | --- a/drivers/tty/tty_buffer.c |
492 | +++ b/drivers/tty/tty_buffer.c |
493 | @@ -388,27 +388,6 @@ int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag) |
494 | } |
495 | EXPORT_SYMBOL(__tty_insert_flip_char); |
496 | |
497 | -/** |
498 | - * tty_schedule_flip - push characters to ldisc |
499 | - * @port: tty port to push from |
500 | - * |
501 | - * Takes any pending buffers and transfers their ownership to the |
502 | - * ldisc side of the queue. It then schedules those characters for |
503 | - * processing by the line discipline. |
504 | - */ |
505 | - |
506 | -void tty_schedule_flip(struct tty_port *port) |
507 | -{ |
508 | - struct tty_bufhead *buf = &port->buf; |
509 | - |
510 | - /* paired w/ acquire in flush_to_ldisc(); ensures |
511 | - * flush_to_ldisc() sees buffer data. |
512 | - */ |
513 | - smp_store_release(&buf->tail->commit, buf->tail->used); |
514 | - queue_work(system_unbound_wq, &buf->work); |
515 | -} |
516 | -EXPORT_SYMBOL(tty_schedule_flip); |
517 | - |
518 | /** |
519 | * tty_prepare_flip_string - make room for characters |
520 | * @port: tty port |
521 | @@ -547,6 +526,15 @@ static void flush_to_ldisc(struct work_struct *work) |
522 | tty_ldisc_deref(disc); |
523 | } |
524 | |
525 | +static inline void tty_flip_buffer_commit(struct tty_buffer *tail) |
526 | +{ |
527 | + /* |
528 | + * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees |
529 | + * buffer data. |
530 | + */ |
531 | + smp_store_release(&tail->commit, tail->used); |
532 | +} |
533 | + |
534 | /** |
535 | * tty_flip_buffer_push - terminal |
536 | * @port: tty port to push |
537 | @@ -560,10 +548,44 @@ static void flush_to_ldisc(struct work_struct *work) |
538 | |
539 | void tty_flip_buffer_push(struct tty_port *port) |
540 | { |
541 | - tty_schedule_flip(port); |
542 | + struct tty_bufhead *buf = &port->buf; |
543 | + |
544 | + tty_flip_buffer_commit(buf->tail); |
545 | + queue_work(system_unbound_wq, &buf->work); |
546 | } |
547 | EXPORT_SYMBOL(tty_flip_buffer_push); |
548 | |
549 | +/** |
550 | + * tty_insert_flip_string_and_push_buffer - add characters to the tty buffer and |
551 | + * push |
552 | + * @port: tty port |
553 | + * @chars: characters |
554 | + * @size: size |
555 | + * |
556 | + * The function combines tty_insert_flip_string() and tty_flip_buffer_push() |
557 | + * with the exception of properly holding the @port->lock. |
558 | + * |
559 | + * To be used only internally (by pty currently). |
560 | + * |
561 | + * Returns: the number added. |
562 | + */ |
563 | +int tty_insert_flip_string_and_push_buffer(struct tty_port *port, |
564 | + const unsigned char *chars, size_t size) |
565 | +{ |
566 | + struct tty_bufhead *buf = &port->buf; |
567 | + unsigned long flags; |
568 | + |
569 | + spin_lock_irqsave(&port->lock, flags); |
570 | + size = tty_insert_flip_string(port, chars, size); |
571 | + if (size) |
572 | + tty_flip_buffer_commit(buf->tail); |
573 | + spin_unlock_irqrestore(&port->lock, flags); |
574 | + |
575 | + queue_work(system_unbound_wq, &buf->work); |
576 | + |
577 | + return size; |
578 | +} |
579 | + |
580 | /** |
581 | * tty_buffer_init - prepare a tty buffer structure |
582 | * @tty: tty to initialise |
583 | diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c |
584 | index 4bc6261ef3c1a..1d20abd7d3c6f 100644 |
585 | --- a/drivers/tty/vt/keyboard.c |
586 | +++ b/drivers/tty/vt/keyboard.c |
587 | @@ -308,7 +308,7 @@ int kbd_rate(struct kbd_repeat *rpt) |
588 | static void put_queue(struct vc_data *vc, int ch) |
589 | { |
590 | tty_insert_flip_char(&vc->port, ch, 0); |
591 | - tty_schedule_flip(&vc->port); |
592 | + tty_flip_buffer_push(&vc->port); |
593 | } |
594 | |
595 | static void puts_queue(struct vc_data *vc, char *cp) |
596 | @@ -317,7 +317,7 @@ static void puts_queue(struct vc_data *vc, char *cp) |
597 | tty_insert_flip_char(&vc->port, *cp, 0); |
598 | cp++; |
599 | } |
600 | - tty_schedule_flip(&vc->port); |
601 | + tty_flip_buffer_push(&vc->port); |
602 | } |
603 | |
604 | static void applkey(struct vc_data *vc, int key, char mode) |
605 | @@ -562,7 +562,7 @@ static void fn_inc_console(struct vc_data *vc) |
606 | static void fn_send_intr(struct vc_data *vc) |
607 | { |
608 | tty_insert_flip_char(&vc->port, 0, TTY_BREAK); |
609 | - tty_schedule_flip(&vc->port); |
610 | + tty_flip_buffer_push(&vc->port); |
611 | } |
612 | |
613 | static void fn_scroll_forw(struct vc_data *vc) |
614 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
615 | index f7a035fa9a97a..29037322d047c 100644 |
616 | --- a/drivers/tty/vt/vt.c |
617 | +++ b/drivers/tty/vt/vt.c |
618 | @@ -1484,7 +1484,7 @@ static void respond_string(const char *p, struct tty_port *port) |
619 | tty_insert_flip_char(port, *p, 0); |
620 | p++; |
621 | } |
622 | - tty_schedule_flip(port); |
623 | + tty_flip_buffer_push(port); |
624 | } |
625 | |
626 | static void cursor_report(struct vc_data *vc, struct tty_struct *tty) |
627 | diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c |
628 | index 2c3248e71e9c1..a6585854a85fc 100644 |
629 | --- a/drivers/xen/gntdev.c |
630 | +++ b/drivers/xen/gntdev.c |
631 | @@ -390,7 +390,8 @@ static void __unmap_grant_pages_done(int result, |
632 | unsigned int offset = data->unmap_ops - map->unmap_ops; |
633 | |
634 | for (i = 0; i < data->count; i++) { |
635 | - WARN_ON(map->unmap_ops[offset+i].status); |
636 | + WARN_ON(map->unmap_ops[offset+i].status && |
637 | + map->unmap_ops[offset+i].handle != -1); |
638 | pr_debug("unmap handle=%d st=%d\n", |
639 | map->unmap_ops[offset+i].handle, |
640 | map->unmap_ops[offset+i].status); |
641 | diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h |
642 | index 53ac461f342bb..491385a8a69d9 100644 |
643 | --- a/include/linux/lsm_hooks.h |
644 | +++ b/include/linux/lsm_hooks.h |
645 | @@ -666,11 +666,6 @@ |
646 | * @sig contains the signal value. |
647 | * @secid contains the sid of the process where the signal originated |
648 | * Return 0 if permission is granted. |
649 | - * @task_wait: |
650 | - * Check permission before allowing a process to reap a child process @p |
651 | - * and collect its status information. |
652 | - * @p contains the task_struct for process. |
653 | - * Return 0 if permission is granted. |
654 | * @task_prctl: |
655 | * Check permission before performing a process control operation on the |
656 | * current process. |
657 | @@ -1507,7 +1502,6 @@ union security_list_options { |
658 | int (*task_movememory)(struct task_struct *p); |
659 | int (*task_kill)(struct task_struct *p, struct siginfo *info, |
660 | int sig, u32 secid); |
661 | - int (*task_wait)(struct task_struct *p); |
662 | int (*task_prctl)(int option, unsigned long arg2, unsigned long arg3, |
663 | unsigned long arg4, unsigned long arg5); |
664 | void (*task_to_inode)(struct task_struct *p, struct inode *inode); |
665 | @@ -1768,7 +1762,6 @@ struct security_hook_heads { |
666 | struct list_head task_getscheduler; |
667 | struct list_head task_movememory; |
668 | struct list_head task_kill; |
669 | - struct list_head task_wait; |
670 | struct list_head task_prctl; |
671 | struct list_head task_to_inode; |
672 | struct list_head ipc_permission; |
673 | diff --git a/include/linux/mfd/rtsx_usb.h b/include/linux/mfd/rtsx_usb.h |
674 | index c446e4fd6b5cc..09b08ff08830c 100644 |
675 | --- a/include/linux/mfd/rtsx_usb.h |
676 | +++ b/include/linux/mfd/rtsx_usb.h |
677 | @@ -65,8 +65,6 @@ struct rtsx_ucr { |
678 | struct usb_device *pusb_dev; |
679 | struct usb_interface *pusb_intf; |
680 | struct usb_sg_request current_sg; |
681 | - unsigned char *iobuf; |
682 | - dma_addr_t iobuf_dma; |
683 | |
684 | struct timer_list sg_timer; |
685 | struct mutex dev_mutex; |
686 | diff --git a/include/linux/security.h b/include/linux/security.h |
687 | index 2f5d282bd3eca..472822a1e02bf 100644 |
688 | --- a/include/linux/security.h |
689 | +++ b/include/linux/security.h |
690 | @@ -332,7 +332,6 @@ int security_task_getscheduler(struct task_struct *p); |
691 | int security_task_movememory(struct task_struct *p); |
692 | int security_task_kill(struct task_struct *p, struct siginfo *info, |
693 | int sig, u32 secid); |
694 | -int security_task_wait(struct task_struct *p); |
695 | int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
696 | unsigned long arg4, unsigned long arg5); |
697 | void security_task_to_inode(struct task_struct *p, struct inode *inode); |
698 | @@ -980,11 +979,6 @@ static inline int security_task_kill(struct task_struct *p, |
699 | return 0; |
700 | } |
701 | |
702 | -static inline int security_task_wait(struct task_struct *p) |
703 | -{ |
704 | - return 0; |
705 | -} |
706 | - |
707 | static inline int security_task_prctl(int option, unsigned long arg2, |
708 | unsigned long arg3, |
709 | unsigned long arg4, |
710 | diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h |
711 | index d43837f2ce3ae..67ccce8be5fba 100644 |
712 | --- a/include/linux/tty_flip.h |
713 | +++ b/include/linux/tty_flip.h |
714 | @@ -11,7 +11,6 @@ extern int tty_insert_flip_string_fixed_flag(struct tty_port *port, |
715 | extern int tty_prepare_flip_string(struct tty_port *port, |
716 | unsigned char **chars, size_t size); |
717 | extern void tty_flip_buffer_push(struct tty_port *port); |
718 | -void tty_schedule_flip(struct tty_port *port); |
719 | int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag); |
720 | |
721 | static inline int tty_insert_flip_char(struct tty_port *port, |
722 | @@ -39,4 +38,7 @@ static inline int tty_insert_flip_string(struct tty_port *port, |
723 | extern void tty_buffer_lock_exclusive(struct tty_port *port); |
724 | extern void tty_buffer_unlock_exclusive(struct tty_port *port); |
725 | |
726 | +int tty_insert_flip_string_and_push_buffer(struct tty_port *port, |
727 | + const unsigned char *chars, size_t cnt); |
728 | + |
729 | #endif /* _LINUX_TTY_FLIP_H */ |
730 | diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h |
731 | index 6213a90a8cecb..f5dbee53fb859 100644 |
732 | --- a/include/net/inet_sock.h |
733 | +++ b/include/net/inet_sock.h |
734 | @@ -113,7 +113,8 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) |
735 | |
736 | static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb) |
737 | { |
738 | - if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) |
739 | + if (!sk->sk_mark && |
740 | + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept)) |
741 | return skb->mark; |
742 | |
743 | return sk->sk_mark; |
744 | diff --git a/include/net/ip.h b/include/net/ip.h |
745 | index c762fd047ef4c..f0e13a2565820 100644 |
746 | --- a/include/net/ip.h |
747 | +++ b/include/net/ip.h |
748 | @@ -283,7 +283,7 @@ void ipfrag_init(void); |
749 | void ip_static_sysctl_init(void); |
750 | |
751 | #define IP4_REPLY_MARK(net, mark) \ |
752 | - ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) |
753 | + (READ_ONCE((net)->ipv4.sysctl_fwmark_reflect) ? (mark) : 0) |
754 | |
755 | static inline bool ip_is_fragment(const struct iphdr *iph) |
756 | { |
757 | diff --git a/include/net/tcp.h b/include/net/tcp.h |
758 | index 97df2f6fcbd79..164dc4f04d0f1 100644 |
759 | --- a/include/net/tcp.h |
760 | +++ b/include/net/tcp.h |
761 | @@ -1788,7 +1788,7 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr); |
762 | static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) |
763 | { |
764 | struct net *net = sock_net((struct sock *)tp); |
765 | - return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat; |
766 | + return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); |
767 | } |
768 | |
769 | static inline bool tcp_stream_memory_free(const struct sock *sk) |
770 | diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c |
771 | index 3ce69c0276c09..9976703f2dbfa 100644 |
772 | --- a/kernel/bpf/core.c |
773 | +++ b/kernel/bpf/core.c |
774 | @@ -60,11 +60,13 @@ void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, uns |
775 | { |
776 | u8 *ptr = NULL; |
777 | |
778 | - if (k >= SKF_NET_OFF) |
779 | + if (k >= SKF_NET_OFF) { |
780 | ptr = skb_network_header(skb) + k - SKF_NET_OFF; |
781 | - else if (k >= SKF_LL_OFF) |
782 | + } else if (k >= SKF_LL_OFF) { |
783 | + if (unlikely(!skb_mac_header_was_set(skb))) |
784 | + return NULL; |
785 | ptr = skb_mac_header(skb) + k - SKF_LL_OFF; |
786 | - |
787 | + } |
788 | if (ptr >= skb->head && ptr + size <= skb_tail_pointer(skb)) |
789 | return ptr; |
790 | |
791 | diff --git a/kernel/events/core.c b/kernel/events/core.c |
792 | index 2466e2ae54dc1..58ef731d52c76 100644 |
793 | --- a/kernel/events/core.c |
794 | +++ b/kernel/events/core.c |
795 | @@ -5291,10 +5291,10 @@ again: |
796 | |
797 | if (!atomic_inc_not_zero(&event->rb->mmap_count)) { |
798 | /* |
799 | - * Raced against perf_mmap_close() through |
800 | - * perf_event_set_output(). Try again, hope for better |
801 | - * luck. |
802 | + * Raced against perf_mmap_close(); remove the |
803 | + * event and try again. |
804 | */ |
805 | + ring_buffer_attach(event, NULL); |
806 | mutex_unlock(&event->mmap_mutex); |
807 | goto again; |
808 | } |
809 | @@ -9542,14 +9542,25 @@ err_size: |
810 | goto out; |
811 | } |
812 | |
813 | +static void mutex_lock_double(struct mutex *a, struct mutex *b) |
814 | +{ |
815 | + if (b < a) |
816 | + swap(a, b); |
817 | + |
818 | + mutex_lock(a); |
819 | + mutex_lock_nested(b, SINGLE_DEPTH_NESTING); |
820 | +} |
821 | + |
822 | static int |
823 | perf_event_set_output(struct perf_event *event, struct perf_event *output_event) |
824 | { |
825 | struct ring_buffer *rb = NULL; |
826 | int ret = -EINVAL; |
827 | |
828 | - if (!output_event) |
829 | + if (!output_event) { |
830 | + mutex_lock(&event->mmap_mutex); |
831 | goto set; |
832 | + } |
833 | |
834 | /* don't allow circular references */ |
835 | if (event == output_event) |
836 | @@ -9587,8 +9598,15 @@ perf_event_set_output(struct perf_event *event, struct perf_event *output_event) |
837 | event->pmu != output_event->pmu) |
838 | goto out; |
839 | |
840 | + /* |
841 | + * Hold both mmap_mutex to serialize against perf_mmap_close(). Since |
842 | + * output_event is already on rb->event_list, and the list iteration |
843 | + * restarts after every removal, it is guaranteed this new event is |
844 | + * observed *OR* if output_event is already removed, it's guaranteed we |
845 | + * observe !rb->mmap_count. |
846 | + */ |
847 | + mutex_lock_double(&event->mmap_mutex, &output_event->mmap_mutex); |
848 | set: |
849 | - mutex_lock(&event->mmap_mutex); |
850 | /* Can't redirect output if we've got an active mmap() */ |
851 | if (atomic_read(&event->mmap_count)) |
852 | goto unlock; |
853 | @@ -9598,6 +9616,12 @@ set: |
854 | rb = ring_buffer_get(output_event); |
855 | if (!rb) |
856 | goto unlock; |
857 | + |
858 | + /* did we race against perf_mmap_close() */ |
859 | + if (!atomic_read(&rb->mmap_count)) { |
860 | + ring_buffer_put(rb); |
861 | + goto unlock; |
862 | + } |
863 | } |
864 | |
865 | ring_buffer_attach(event, rb); |
866 | @@ -9605,20 +9629,13 @@ set: |
867 | ret = 0; |
868 | unlock: |
869 | mutex_unlock(&event->mmap_mutex); |
870 | + if (output_event) |
871 | + mutex_unlock(&output_event->mmap_mutex); |
872 | |
873 | out: |
874 | return ret; |
875 | } |
876 | |
877 | -static void mutex_lock_double(struct mutex *a, struct mutex *b) |
878 | -{ |
879 | - if (b < a) |
880 | - swap(a, b); |
881 | - |
882 | - mutex_lock(a); |
883 | - mutex_lock_nested(b, SINGLE_DEPTH_NESTING); |
884 | -} |
885 | - |
886 | static int perf_event_set_clock(struct perf_event *event, clockid_t clk_id) |
887 | { |
888 | bool nmi_safe = false; |
889 | diff --git a/kernel/exit.c b/kernel/exit.c |
890 | index 8716f0780fe3d..e0db254a405bb 100644 |
891 | --- a/kernel/exit.c |
892 | +++ b/kernel/exit.c |
893 | @@ -14,7 +14,6 @@ |
894 | #include <linux/tty.h> |
895 | #include <linux/iocontext.h> |
896 | #include <linux/key.h> |
897 | -#include <linux/security.h> |
898 | #include <linux/cpu.h> |
899 | #include <linux/acct.h> |
900 | #include <linux/tsacct_kern.h> |
901 | @@ -1342,7 +1341,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) |
902 | * Returns nonzero for a final return, when we have unlocked tasklist_lock. |
903 | * Returns zero if the search for a child should continue; |
904 | * then ->notask_error is 0 if @p is an eligible child, |
905 | - * or another error from security_task_wait(), or still -ECHILD. |
906 | + * or still -ECHILD. |
907 | */ |
908 | static int wait_consider_task(struct wait_opts *wo, int ptrace, |
909 | struct task_struct *p) |
910 | @@ -1362,20 +1361,6 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace, |
911 | if (!ret) |
912 | return ret; |
913 | |
914 | - ret = security_task_wait(p); |
915 | - if (unlikely(ret < 0)) { |
916 | - /* |
917 | - * If we have not yet seen any eligible child, |
918 | - * then let this error code replace -ECHILD. |
919 | - * A permission error will give the user a clue |
920 | - * to look for security policy problems, rather |
921 | - * than for mysterious wait bugs. |
922 | - */ |
923 | - if (wo->notask_error) |
924 | - wo->notask_error = ret; |
925 | - return 0; |
926 | - } |
927 | - |
928 | if (unlikely(exit_state == EXIT_TRACE)) { |
929 | /* |
930 | * ptrace == 0 means we are the natural parent. In this case |
931 | @@ -1468,7 +1453,7 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace, |
932 | * Returns nonzero for a final return, when we have unlocked tasklist_lock. |
933 | * Returns zero if the search for a child should continue; then |
934 | * ->notask_error is 0 if there were any eligible children, |
935 | - * or another error from security_task_wait(), or still -ECHILD. |
936 | + * or still -ECHILD. |
937 | */ |
938 | static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk) |
939 | { |
940 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
941 | index 6059f85546fe9..2990a05777bde 100644 |
942 | --- a/mm/mempolicy.c |
943 | +++ b/mm/mempolicy.c |
944 | @@ -396,7 +396,7 @@ static void mpol_rebind_preferred(struct mempolicy *pol, |
945 | static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask, |
946 | enum mpol_rebind_step step) |
947 | { |
948 | - if (!pol) |
949 | + if (!pol || pol->mode == MPOL_LOCAL) |
950 | return; |
951 | if (!mpol_store_user_nodemask(pol) && step == MPOL_REBIND_ONCE && |
952 | nodes_equal(pol->w.cpuset_mems_allowed, *newmask)) |
953 | diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
954 | index 75f961425639e..3c09bee931b7a 100644 |
955 | --- a/net/ipv4/igmp.c |
956 | +++ b/net/ipv4/igmp.c |
957 | @@ -474,7 +474,8 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, |
958 | |
959 | if (pmc->multiaddr == IGMP_ALL_HOSTS) |
960 | return skb; |
961 | - if (ipv4_is_local_multicast(pmc->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
962 | + if (ipv4_is_local_multicast(pmc->multiaddr) && |
963 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
964 | return skb; |
965 | |
966 | mtu = READ_ONCE(dev->mtu); |
967 | @@ -600,7 +601,7 @@ static int igmpv3_send_report(struct in_device *in_dev, struct ip_mc_list *pmc) |
968 | if (pmc->multiaddr == IGMP_ALL_HOSTS) |
969 | continue; |
970 | if (ipv4_is_local_multicast(pmc->multiaddr) && |
971 | - !net->ipv4.sysctl_igmp_llm_reports) |
972 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
973 | continue; |
974 | spin_lock_bh(&pmc->lock); |
975 | if (pmc->sfcount[MCAST_EXCLUDE]) |
976 | @@ -743,7 +744,8 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, |
977 | if (type == IGMPV3_HOST_MEMBERSHIP_REPORT) |
978 | return igmpv3_send_report(in_dev, pmc); |
979 | |
980 | - if (ipv4_is_local_multicast(group) && !net->ipv4.sysctl_igmp_llm_reports) |
981 | + if (ipv4_is_local_multicast(group) && |
982 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
983 | return 0; |
984 | |
985 | if (type == IGMP_HOST_LEAVE_MESSAGE) |
986 | @@ -921,7 +923,8 @@ static bool igmp_heard_report(struct in_device *in_dev, __be32 group) |
987 | |
988 | if (group == IGMP_ALL_HOSTS) |
989 | return false; |
990 | - if (ipv4_is_local_multicast(group) && !net->ipv4.sysctl_igmp_llm_reports) |
991 | + if (ipv4_is_local_multicast(group) && |
992 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
993 | return false; |
994 | |
995 | rcu_read_lock(); |
996 | @@ -1031,7 +1034,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, |
997 | if (im->multiaddr == IGMP_ALL_HOSTS) |
998 | continue; |
999 | if (ipv4_is_local_multicast(im->multiaddr) && |
1000 | - !net->ipv4.sysctl_igmp_llm_reports) |
1001 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
1002 | continue; |
1003 | spin_lock_bh(&im->lock); |
1004 | if (im->tm_running) |
1005 | @@ -1272,7 +1275,8 @@ static void igmp_group_dropped(struct ip_mc_list *im) |
1006 | #ifdef CONFIG_IP_MULTICAST |
1007 | if (im->multiaddr == IGMP_ALL_HOSTS) |
1008 | return; |
1009 | - if (ipv4_is_local_multicast(im->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
1010 | + if (ipv4_is_local_multicast(im->multiaddr) && |
1011 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
1012 | return; |
1013 | |
1014 | reporter = im->reporter; |
1015 | @@ -1309,7 +1313,8 @@ static void igmp_group_added(struct ip_mc_list *im) |
1016 | #ifdef CONFIG_IP_MULTICAST |
1017 | if (im->multiaddr == IGMP_ALL_HOSTS) |
1018 | return; |
1019 | - if (ipv4_is_local_multicast(im->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
1020 | + if (ipv4_is_local_multicast(im->multiaddr) && |
1021 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
1022 | return; |
1023 | |
1024 | if (in_dev->dead) |
1025 | @@ -1621,7 +1626,7 @@ static void ip_mc_rejoin_groups(struct in_device *in_dev) |
1026 | if (im->multiaddr == IGMP_ALL_HOSTS) |
1027 | continue; |
1028 | if (ipv4_is_local_multicast(im->multiaddr) && |
1029 | - !net->ipv4.sysctl_igmp_llm_reports) |
1030 | + !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
1031 | continue; |
1032 | |
1033 | /* a failover is happening and switches |
1034 | @@ -2166,7 +2171,7 @@ int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr) |
1035 | count++; |
1036 | } |
1037 | err = -ENOBUFS; |
1038 | - if (count >= net->ipv4.sysctl_igmp_max_memberships) |
1039 | + if (count >= READ_ONCE(net->ipv4.sysctl_igmp_max_memberships)) |
1040 | goto done; |
1041 | iml = sock_kmalloc(sk, sizeof(*iml), GFP_KERNEL); |
1042 | if (!iml) |
1043 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
1044 | index e0009cd69da75..5b6d935a028c2 100644 |
1045 | --- a/net/ipv4/tcp_output.c |
1046 | +++ b/net/ipv4/tcp_output.c |
1047 | @@ -2005,7 +2005,7 @@ static int tcp_mtu_probe(struct sock *sk) |
1048 | * probing process by not resetting search range to its orignal. |
1049 | */ |
1050 | if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high) || |
1051 | - interval < net->ipv4.sysctl_tcp_probe_threshold) { |
1052 | + interval < READ_ONCE(net->ipv4.sysctl_tcp_probe_threshold)) { |
1053 | /* Check whether enough time has elaplased for |
1054 | * another round of probing. |
1055 | */ |
1056 | diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
1057 | index 9179b47e8b61f..0894108f561cb 100644 |
1058 | --- a/net/xfrm/xfrm_policy.c |
1059 | +++ b/net/xfrm/xfrm_policy.c |
1060 | @@ -1819,8 +1819,10 @@ static int xfrm_expand_policies(const struct flowi *fl, u16 family, |
1061 | *num_xfrms = 0; |
1062 | return 0; |
1063 | } |
1064 | - if (IS_ERR(pols[0])) |
1065 | + if (IS_ERR(pols[0])) { |
1066 | + *num_pols = 0; |
1067 | return PTR_ERR(pols[0]); |
1068 | + } |
1069 | |
1070 | *num_xfrms = pols[0]->xfrm_nr; |
1071 | |
1072 | @@ -1834,6 +1836,7 @@ static int xfrm_expand_policies(const struct flowi *fl, u16 family, |
1073 | if (pols[1]) { |
1074 | if (IS_ERR(pols[1])) { |
1075 | xfrm_pols_put(pols, *num_pols); |
1076 | + *num_pols = 0; |
1077 | return PTR_ERR(pols[1]); |
1078 | } |
1079 | (*num_pols)++; |
1080 | diff --git a/security/security.c b/security/security.c |
1081 | index 9a13d72a64465..5171c3cd1d304 100644 |
1082 | --- a/security/security.c |
1083 | +++ b/security/security.c |
1084 | @@ -1032,11 +1032,6 @@ int security_task_kill(struct task_struct *p, struct siginfo *info, |
1085 | return call_int_hook(task_kill, 0, p, info, sig, secid); |
1086 | } |
1087 | |
1088 | -int security_task_wait(struct task_struct *p) |
1089 | -{ |
1090 | - return call_int_hook(task_wait, 0, p); |
1091 | -} |
1092 | - |
1093 | int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
1094 | unsigned long arg4, unsigned long arg5) |
1095 | { |
1096 | @@ -1776,7 +1771,6 @@ struct security_hook_heads security_hook_heads = { |
1097 | .task_movememory = |
1098 | LIST_HEAD_INIT(security_hook_heads.task_movememory), |
1099 | .task_kill = LIST_HEAD_INIT(security_hook_heads.task_kill), |
1100 | - .task_wait = LIST_HEAD_INIT(security_hook_heads.task_wait), |
1101 | .task_prctl = LIST_HEAD_INIT(security_hook_heads.task_prctl), |
1102 | .task_to_inode = |
1103 | LIST_HEAD_INIT(security_hook_heads.task_to_inode), |
1104 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
1105 | index eb9e2b4e81d92..eb503eccbacc8 100644 |
1106 | --- a/security/selinux/hooks.c |
1107 | +++ b/security/selinux/hooks.c |
1108 | @@ -3951,11 +3951,6 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info, |
1109 | return rc; |
1110 | } |
1111 | |
1112 | -static int selinux_task_wait(struct task_struct *p) |
1113 | -{ |
1114 | - return task_has_perm(p, current, PROCESS__SIGCHLD); |
1115 | -} |
1116 | - |
1117 | static void selinux_task_to_inode(struct task_struct *p, |
1118 | struct inode *inode) |
1119 | { |
1120 | @@ -6220,7 +6215,6 @@ static struct security_hook_list selinux_hooks[] = { |
1121 | LSM_HOOK_INIT(task_getscheduler, selinux_task_getscheduler), |
1122 | LSM_HOOK_INIT(task_movememory, selinux_task_movememory), |
1123 | LSM_HOOK_INIT(task_kill, selinux_task_kill), |
1124 | - LSM_HOOK_INIT(task_wait, selinux_task_wait), |
1125 | LSM_HOOK_INIT(task_to_inode, selinux_task_to_inode), |
1126 | |
1127 | LSM_HOOK_INIT(ipc_permission, selinux_ipc_permission), |
1128 | diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c |
1129 | index 84ed47195cdd2..f01b69ead47ec 100644 |
1130 | --- a/security/smack/smack_lsm.c |
1131 | +++ b/security/smack/smack_lsm.c |
1132 | @@ -2276,25 +2276,6 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info, |
1133 | return rc; |
1134 | } |
1135 | |
1136 | -/** |
1137 | - * smack_task_wait - Smack access check for waiting |
1138 | - * @p: task to wait for |
1139 | - * |
1140 | - * Returns 0 |
1141 | - */ |
1142 | -static int smack_task_wait(struct task_struct *p) |
1143 | -{ |
1144 | - /* |
1145 | - * Allow the operation to succeed. |
1146 | - * Zombies are bad. |
1147 | - * In userless environments (e.g. phones) programs |
1148 | - * get marked with SMACK64EXEC and even if the parent |
1149 | - * and child shouldn't be talking the parent still |
1150 | - * may expect to know when the child exits. |
1151 | - */ |
1152 | - return 0; |
1153 | -} |
1154 | - |
1155 | /** |
1156 | * smack_task_to_inode - copy task smack into the inode blob |
1157 | * @p: task to copy from |
1158 | @@ -4686,7 +4667,6 @@ static struct security_hook_list smack_hooks[] = { |
1159 | LSM_HOOK_INIT(task_getscheduler, smack_task_getscheduler), |
1160 | LSM_HOOK_INIT(task_movememory, smack_task_movememory), |
1161 | LSM_HOOK_INIT(task_kill, smack_task_kill), |
1162 | - LSM_HOOK_INIT(task_wait, smack_task_wait), |
1163 | LSM_HOOK_INIT(task_to_inode, smack_task_to_inode), |
1164 | |
1165 | LSM_HOOK_INIT(ipc_permission, smack_ipc_permission), |
1166 | diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c |
1167 | index 78ffe445d7757..a67fbcabfa67d 100644 |
1168 | --- a/sound/core/memalloc.c |
1169 | +++ b/sound/core/memalloc.c |
1170 | @@ -177,6 +177,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, |
1171 | if (WARN_ON(!dmab)) |
1172 | return -ENXIO; |
1173 | |
1174 | + size = PAGE_ALIGN(size); |
1175 | dmab->dev.type = type; |
1176 | dmab->dev.dev = device; |
1177 | dmab->bytes = 0; |