Skip to content

Commit 5de0e31

Browse files
committed
Merge remote-tracking branch 'stable/linux-5.7.y' into v5.7+
2 parents 06715b9 + 67da9e2 commit 5de0e31

21 files changed

Lines changed: 139 additions & 78 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 5
33
PATCHLEVEL = 7
4-
SUBLEVEL = 11
4+
SUBLEVEL = 12
55
EXTRAVERSION =
66
NAME = Kleptomaniac Octopus
77

drivers/base/regmap/regmap-debugfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
227227
if (*ppos < 0 || !count)
228228
return -EINVAL;
229229

230+
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
231+
count = PAGE_SIZE << (MAX_ORDER - 1);
232+
230233
buf = kmalloc(count, GFP_KERNEL);
231234
if (!buf)
232235
return -ENOMEM;
@@ -371,6 +374,9 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file,
371374
if (*ppos < 0 || !count)
372375
return -EINVAL;
373376

377+
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
378+
count = PAGE_SIZE << (MAX_ORDER - 1);
379+
374380
buf = kmalloc(count, GFP_KERNEL);
375381
if (!buf)
376382
return -ENOMEM;

drivers/net/wan/x25_asy.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static inline void x25_asy_unlock(struct x25_asy *sl)
183183
netif_wake_queue(sl->dev);
184184
}
185185

186-
/* Send one completely decapsulated IP datagram to the IP layer. */
186+
/* Send an LAPB frame to the LAPB module to process. */
187187

188188
static void x25_asy_bump(struct x25_asy *sl)
189189
{
@@ -195,21 +195,19 @@ static void x25_asy_bump(struct x25_asy *sl)
195195
count = sl->rcount;
196196
dev->stats.rx_bytes += count;
197197

198-
skb = dev_alloc_skb(count+1);
198+
skb = dev_alloc_skb(count);
199199
if (skb == NULL) {
200200
netdev_warn(sl->dev, "memory squeeze, dropping packet\n");
201201
dev->stats.rx_dropped++;
202202
return;
203203
}
204-
skb_push(skb, 1); /* LAPB internal control */
205204
skb_put_data(skb, sl->rbuff, count);
206205
skb->protocol = x25_type_trans(skb, sl->dev);
207206
err = lapb_data_received(skb->dev, skb);
208207
if (err != LAPB_OK) {
209208
kfree_skb(skb);
210209
printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);
211210
} else {
212-
netif_rx(skb);
213211
dev->stats.rx_packets++;
214212
}
215213
}
@@ -356,12 +354,21 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
356354
*/
357355

358356
/*
359-
* Called when I frame data arrives. We did the work above - throw it
360-
* at the net layer.
357+
* Called when I frame data arrive. We add a pseudo header for upper
358+
* layers and pass it to upper layers.
361359
*/
362360

363361
static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb)
364362
{
363+
if (skb_cow(skb, 1)) {
364+
kfree_skb(skb);
365+
return NET_RX_DROP;
366+
}
367+
skb_push(skb, 1);
368+
skb->data[0] = X25_IFACE_DATA;
369+
370+
skb->protocol = x25_type_trans(skb, dev);
371+
365372
return netif_rx(skb);
366373
}
367374

@@ -657,7 +664,7 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)
657664
switch (s) {
658665
case X25_END:
659666
if (!test_and_clear_bit(SLF_ERROR, &sl->flags) &&
660-
sl->rcount > 2)
667+
sl->rcount >= 2)
661668
x25_asy_bump(sl);
662669
clear_bit(SLF_ESCAPE, &sl->flags);
663670
sl->rcount = 0;

fs/io_uring.c

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ enum {
581581

582582
struct async_poll {
583583
struct io_poll_iocb poll;
584+
struct io_poll_iocb *double_poll;
584585
struct io_wq_work work;
585586
};
586587

@@ -4220,9 +4221,9 @@ static bool io_poll_rewait(struct io_kiocb *req, struct io_poll_iocb *poll)
42204221
return false;
42214222
}
42224223

4223-
static void io_poll_remove_double(struct io_kiocb *req)
4224+
static void io_poll_remove_double(struct io_kiocb *req, void *data)
42244225
{
4225-
struct io_poll_iocb *poll = (struct io_poll_iocb *) req->io;
4226+
struct io_poll_iocb *poll = data;
42264227

42274228
lockdep_assert_held(&req->ctx->completion_lock);
42284229

@@ -4242,7 +4243,7 @@ static void io_poll_complete(struct io_kiocb *req, __poll_t mask, int error)
42424243
{
42434244
struct io_ring_ctx *ctx = req->ctx;
42444245

4245-
io_poll_remove_double(req);
4246+
io_poll_remove_double(req, req->io);
42464247
req->poll.done = true;
42474248
io_cqring_fill_event(req, error ? error : mangle_poll(mask));
42484249
io_commit_cqring(ctx);
@@ -4285,21 +4286,21 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
42854286
int sync, void *key)
42864287
{
42874288
struct io_kiocb *req = wait->private;
4288-
struct io_poll_iocb *poll = (struct io_poll_iocb *) req->io;
4289+
struct io_poll_iocb *poll = req->apoll->double_poll;
42894290
__poll_t mask = key_to_poll(key);
42904291

42914292
/* for instances that support it check for an event match first: */
42924293
if (mask && !(mask & poll->events))
42934294
return 0;
42944295

4295-
if (req->poll.head) {
4296+
if (poll && poll->head) {
42964297
bool done;
42974298

4298-
spin_lock(&req->poll.head->lock);
4299-
done = list_empty(&req->poll.wait.entry);
4299+
spin_lock(&poll->head->lock);
4300+
done = list_empty(&poll->wait.entry);
43004301
if (!done)
4301-
list_del_init(&req->poll.wait.entry);
4302-
spin_unlock(&req->poll.head->lock);
4302+
list_del_init(&poll->wait.entry);
4303+
spin_unlock(&poll->head->lock);
43034304
if (!done)
43044305
__io_async_wake(req, poll, mask, io_poll_task_func);
43054306
}
@@ -4319,7 +4320,8 @@ static void io_init_poll_iocb(struct io_poll_iocb *poll, __poll_t events,
43194320
}
43204321

43214322
static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
4322-
struct wait_queue_head *head)
4323+
struct wait_queue_head *head,
4324+
struct io_poll_iocb **poll_ptr)
43234325
{
43244326
struct io_kiocb *req = pt->req;
43254327

@@ -4330,7 +4332,7 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
43304332
*/
43314333
if (unlikely(poll->head)) {
43324334
/* already have a 2nd entry, fail a third attempt */
4333-
if (req->io) {
4335+
if (*poll_ptr) {
43344336
pt->error = -EINVAL;
43354337
return;
43364338
}
@@ -4342,7 +4344,7 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
43424344
io_init_poll_iocb(poll, req->poll.events, io_poll_double_wake);
43434345
refcount_inc(&req->refs);
43444346
poll->wait.private = req;
4345-
req->io = (void *) poll;
4347+
*poll_ptr = poll;
43464348
}
43474349

43484350
pt->error = 0;
@@ -4354,8 +4356,9 @@ static void io_async_queue_proc(struct file *file, struct wait_queue_head *head,
43544356
struct poll_table_struct *p)
43554357
{
43564358
struct io_poll_table *pt = container_of(p, struct io_poll_table, pt);
4359+
struct async_poll *apoll = pt->req->apoll;
43574360

4358-
__io_queue_proc(&pt->req->apoll->poll, pt, head);
4361+
__io_queue_proc(&apoll->poll, pt, head, &apoll->double_poll);
43594362
}
43604363

43614364
static void io_sq_thread_drop_mm(struct io_ring_ctx *ctx)
@@ -4409,6 +4412,7 @@ static void io_async_task_func(struct callback_head *cb)
44094412
memcpy(&req->work, &apoll->work, sizeof(req->work));
44104413

44114414
if (canceled) {
4415+
kfree(apoll->double_poll);
44124416
kfree(apoll);
44134417
io_cqring_ev_posted(ctx);
44144418
end_req:
@@ -4426,6 +4430,7 @@ static void io_async_task_func(struct callback_head *cb)
44264430
__io_queue_sqe(req, NULL);
44274431
mutex_unlock(&ctx->uring_lock);
44284432

4433+
kfree(apoll->double_poll);
44294434
kfree(apoll);
44304435
}
44314436

@@ -4497,7 +4502,6 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
44974502
struct async_poll *apoll;
44984503
struct io_poll_table ipt;
44994504
__poll_t mask, ret;
4500-
bool had_io;
45014505

45024506
if (!req->file || !file_can_poll(req->file))
45034507
return false;
@@ -4509,10 +4513,10 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
45094513
apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
45104514
if (unlikely(!apoll))
45114515
return false;
4516+
apoll->double_poll = NULL;
45124517

45134518
req->flags |= REQ_F_POLLED;
45144519
memcpy(&apoll->work, &req->work, sizeof(req->work));
4515-
had_io = req->io != NULL;
45164520

45174521
get_task_struct(current);
45184522
req->task = current;
@@ -4531,12 +4535,10 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
45314535
ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask,
45324536
io_async_wake);
45334537
if (ret) {
4534-
ipt.error = 0;
4535-
/* only remove double add if we did it here */
4536-
if (!had_io)
4537-
io_poll_remove_double(req);
4538+
io_poll_remove_double(req, apoll->double_poll);
45384539
spin_unlock_irq(&ctx->completion_lock);
45394540
memcpy(&req->work, &apoll->work, sizeof(req->work));
4541+
kfree(apoll->double_poll);
45404542
kfree(apoll);
45414543
return false;
45424544
}
@@ -4567,11 +4569,13 @@ static bool io_poll_remove_one(struct io_kiocb *req)
45674569
bool do_complete;
45684570

45694571
if (req->opcode == IORING_OP_POLL_ADD) {
4570-
io_poll_remove_double(req);
4572+
io_poll_remove_double(req, req->io);
45714573
do_complete = __io_poll_remove_one(req, &req->poll);
45724574
} else {
45734575
struct async_poll *apoll = req->apoll;
45744576

4577+
io_poll_remove_double(req, apoll->double_poll);
4578+
45754579
/* non-poll requests have submit ref still */
45764580
do_complete = __io_poll_remove_one(req, &apoll->poll);
45774581
if (do_complete) {
@@ -4582,6 +4586,7 @@ static bool io_poll_remove_one(struct io_kiocb *req)
45824586
* final reference.
45834587
*/
45844588
memcpy(&req->work, &apoll->work, sizeof(req->work));
4589+
kfree(apoll->double_poll);
45854590
kfree(apoll);
45864591
}
45874592
}
@@ -4682,7 +4687,7 @@ static void io_poll_queue_proc(struct file *file, struct wait_queue_head *head,
46824687
{
46834688
struct io_poll_table *pt = container_of(p, struct io_poll_table, pt);
46844689

4685-
__io_queue_proc(&pt->req->poll, pt, head);
4690+
__io_queue_proc(&pt->req->poll, pt, head, (struct io_poll_iocb **) &pt->req->io);
46864691
}
46874692

46884693
static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)

include/linux/tcp.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ struct tcp_sock {
217217
} rack;
218218
u16 advmss; /* Advertised MSS */
219219
u8 compressed_ack;
220+
u8 tlp_retrans:1, /* TLP is a retransmission */
221+
unused:7;
220222
u32 chrono_start; /* Start time in jiffies of a TCP chrono */
221223
u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
222224
u8 chrono_type:2, /* current chronograph type */
@@ -239,7 +241,7 @@ struct tcp_sock {
239241
save_syn:1, /* Save headers of SYN packet */
240242
is_cwnd_limited:1,/* forward progress limited by snd_cwnd? */
241243
syn_smc:1; /* SYN includes SMC */
242-
u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
244+
u32 tlp_high_seq; /* snd_nxt at the time of TLP */
243245

244246
u32 tcp_tx_delay; /* delay (in usec) added to TX packets */
245247
u64 tcp_wstamp_ns; /* departure time for next sent data packet */

net/ax25/af_ax25.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,10 @@ static int __must_check ax25_connect(struct socket *sock,
11871187
if (addr_len > sizeof(struct sockaddr_ax25) &&
11881188
fsa->fsa_ax25.sax25_ndigis != 0) {
11891189
/* Valid number of digipeaters ? */
1190-
if (fsa->fsa_ax25.sax25_ndigis < 1 || fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS) {
1190+
if (fsa->fsa_ax25.sax25_ndigis < 1 ||
1191+
fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS ||
1192+
addr_len < sizeof(struct sockaddr_ax25) +
1193+
sizeof(ax25_address) * fsa->fsa_ax25.sax25_ndigis) {
11911194
err = -EINVAL;
11921195
goto out_release;
11931196
}
@@ -1507,7 +1510,10 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
15071510
struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax;
15081511

15091512
/* Valid number of digipeaters ? */
1510-
if (usax->sax25_ndigis < 1 || usax->sax25_ndigis > AX25_MAX_DIGIS) {
1513+
if (usax->sax25_ndigis < 1 ||
1514+
usax->sax25_ndigis > AX25_MAX_DIGIS ||
1515+
addr_len < sizeof(struct sockaddr_ax25) +
1516+
sizeof(ax25_address) * usax->sax25_ndigis) {
15111517
err = -EINVAL;
15121518
goto out;
15131519
}

net/core/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5504,7 +5504,7 @@ static void flush_backlog(struct work_struct *work)
55045504
skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) {
55055505
if (skb->dev->reg_state == NETREG_UNREGISTERING) {
55065506
__skb_unlink(skb, &sd->input_pkt_queue);
5507-
kfree_skb(skb);
5507+
dev_kfree_skb_irq(skb);
55085508
input_queue_head_incr(sd);
55095509
}
55105510
}

net/core/net-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ static ssize_t tx_timeout_show(struct netdev_queue *queue, char *buf)
10771077
trans_timeout = queue->trans_timeout;
10781078
spin_unlock_irq(&queue->_xmit_lock);
10791079

1080-
return sprintf(buf, "%lu", trans_timeout);
1080+
return sprintf(buf, fmt_ulong, trans_timeout);
10811081
}
10821082

10831083
static unsigned int get_netdev_queue_index(struct netdev_queue *queue)

net/core/rtnetlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3337,7 +3337,8 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
33373337
*/
33383338
if (err < 0) {
33393339
/* If device is not registered at all, free it now */
3340-
if (dev->reg_state == NETREG_UNINITIALIZED)
3340+
if (dev->reg_state == NETREG_UNINITIALIZED ||
3341+
dev->reg_state == NETREG_UNREGISTERED)
33413342
free_netdev(dev);
33423343
goto out;
33433344
}

net/core/sock_reuseport.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static struct sock_reuseport *reuseport_grow(struct sock_reuseport *reuse)
101101
more_reuse->prog = reuse->prog;
102102
more_reuse->reuseport_id = reuse->reuseport_id;
103103
more_reuse->bind_inany = reuse->bind_inany;
104+
more_reuse->has_conns = reuse->has_conns;
104105

105106
memcpy(more_reuse->socks, reuse->socks,
106107
reuse->num_socks * sizeof(struct sock *));

0 commit comments

Comments
 (0)