5.10.235-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 451/462 Revert "media: uvcvideo: Require entities to have a non-zero unique ID"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 8004d635f27bbccaa5c083c50d4d5302a6ffa00e upstream.
This reverts commit 3dd075fe8ebbc6fcbf998f81a75b8c4b159a6195.
Tomasz has reported that his device, Generalplus Technology Inc. 808 Camera, with ID 1b3f:2002, stopped being detected:
$ ls -l /dev/video* zsh: no matches found: /dev/video* [ 7.230599] usb 3-2: Found multiple Units with ID 5
This particular device is non-compliant, having both the Output Terminal and Processing Unit with ID 5. uvc_scan_fallback, though, is able to build a chain. However, when media elements are added and uvc_mc_create_links call uvc_entity_by_id, it will get the incorrect entity, media_create_pad_link will WARN, and it will fail to register the entities.
In order to reinstate support for such devices in a timely fashion, reverting the fix for these warnings is appropriate. A proper fix that considers the existence of such non-compliant devices will be submitted in a later development cycle.
--- drivers/media/usb/uvc/uvc_driver.c | 63 ++++++++++++++----------------------- 1 file changed, 24 insertions(+), 39 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +24 -39
@@ -1029,27 +1029,14 @@ error:return ret; } -static struct uvc_entity *uvc_alloc_new_entity (struct uvc_device *dev,u16 type, -u16 id,unsigned int num_pads, -unsigned int extra_size) +static struct uvc_entity *uvc_alloc_entity (u16 type,u8 id, +unsigned int num_pads,unsigned int extra_size) {struct uvc_entity *entity;unsigned int num_inputs;unsigned int size;unsigned int i; -/* Per UVC 1.1+ spec 3.7.2, the ID should be non-zero. */ -if (id ==0 ) { -dev_err (&dev->udev->dev,"Found Unit with invalid ID 0.\n" ); -return ERR_PTR (-EINVAL ); - } - -/* Per UVC 1.1+ spec 3.7.2, the ID is unique. */ -if (uvc_entity_by_id (dev, id)) { -dev_err (&dev->udev->dev,"Found multiple Units with ID %u\n" , id); -return ERR_PTR (-EINVAL ); - } - extra_size =roundup (extra_size,sizeof (*entity->pads));if (num_pads) num_inputs = type &UVC_TERM_OUTPUT ? num_pads : num_pads -1 ;
@@ -1059,7 +1046,7 @@ static struct uvc_entity *uvc_alloc_new_ + num_inputs; entity =kzalloc (size,GFP_KERNEL );if (entity ==NULL ) -return ERR_PTR (-ENOMEM ); +return NULL ; entity->id = id; entity->type = type;
@@ -1130,10 +1117,10 @@ static int uvc_parse_vendor_control(strubreak ; } - unit =uvc_alloc_new_entity (dev,UVC_VC_EXTENSION_UNIT , - buffer[3 ], p +1 ,2 * n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (UVC_VC_EXTENSION_UNIT , buffer[3 ], + p +1 ,2 *n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->extension.guidExtensionCode, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
@@ -1244,10 +1231,10 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - term =uvc_alloc_new_entity (dev, type |UVC_TERM_INPUT , - buffer[3 ],1 , n + p); -if (IS_ERR (term)) -return PTR_ERR (term); + term =uvc_alloc_entity (type |UVC_TERM_INPUT , buffer[3 ], +1 , n + p); +if (term ==NULL ) +return -ENOMEM ;if (UVC_ENTITY_TYPE (term) ==UVC_ITT_CAMERA ) { term->camera.bControlSize = n;
@@ -1303,10 +1290,10 @@ static int uvc_parse_standard_control(streturn 0 ; } - term =uvc_alloc_new_entity (dev, type |UVC_TERM_OUTPUT , - buffer[3 ],1 ,0 ); -if (IS_ERR (term)) -return PTR_ERR (term); + term =uvc_alloc_entity (type |UVC_TERM_OUTPUT , buffer[3 ], +1 ,0 ); +if (term ==NULL ) +return -ENOMEM ;memcpy (term->baSourceID, &buffer[7 ],1 );
@@ -1327,10 +1314,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], - p +1 ,0 ); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 ,0 ); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->baSourceID, &buffer[5 ], p);
@@ -1352,9 +1338,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ],2 , n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ],2 , n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->baSourceID, &buffer[4 ],1 ); unit->processing.wMaxMultiplier =
@@ -1383,10 +1369,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], - p +1 , n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 , n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->extension.guidExtensionCode, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
Greg Kroah-Hartman
maintainerPATCH 452/462 bpf, vsock: Invoke proto::close on close()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
commit 135ffc7becc82cfb84936ae133da7969220b43b2 upstream.
vsock defines a BPF callback to be invoked when close() is called. However, this callback is never actually executed. As a result, a closed vsock socket is not automatically removed from the sockmap/sockhash.
Introduce a dummy vsock_close() and make vsock_release() call proto::close.
Note: changes in __vsock_release() look messy, but it's only due to indent level reduction and variables xmas tree reorder.
[LL: There is no sockmap support for this kernel version. This patch has been backported because it helps reduce conflicts on future backports]
--- net/vmw_vsock/af_vsock.c | 71 +++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 29 deletions(-)
net/vmw_vsock/af_vsock.c +42 -29
@@ -113,12 +113,14 @@static int __vsock_bind (struct sock *sk,struct sockaddr_vm *addr);static void vsock_sk_destruct (struct sock *sk);static int vsock_queue_rcv_skb (struct sock *sk,struct sk_buff *skb); +static void vsock_close (struct sock *sk,long timeout);/* Protocol family. */ static struct proto vsock_proto = { .name ="AF_VSOCK" , .owner =THIS_MODULE , .obj_size =sizeof (struct vsock_sock ), + .close = vsock_close, };/* The default peer timeout indicates how long we will wait for a peer response
@@ -767,39 +769,37 @@ static struct sock *__vsock_create(strucstatic void __vsock_release (struct sock *sk,int level) { -if (sk) { -struct sock *pending; -struct vsock_sock *vsk; +struct vsock_sock *vsk; +struct sock *pending; - vsk =vsock_sk (sk); - pending =NULL ;/* Compiler warning. */ + vsk =vsock_sk (sk); + pending =NULL ;/* Compiler warning. */ -/* When "level" is SINGLE_DEPTH_NESTING, use the nested -* version to avoid the warning "possible recursive locking -* detected". When "level" is 0, lock_sock_nested(sk, level) -* is the same as lock_sock(sk). -*/ -lock_sock_nested (sk, level); +/* When "level" is SINGLE_DEPTH_NESTING, use the nested +* version to avoid the warning "possible recursive locking +* detected". When "level" is 0, lock_sock_nested(sk, level) +* is the same as lock_sock(sk). +*/ +lock_sock_nested (sk, level); -if (vsk->transport) - vsk->transport->release (vsk); -else if (sk->sk_type ==SOCK_STREAM ) -vsock_remove_sock (vsk); - -sock_orphan (sk); - sk->sk_shutdown =SHUTDOWN_MASK ; - -skb_queue_purge (&sk->sk_receive_queue); - -/* Clean up any sockets that never were accepted. */ -while ((pending =vsock_dequeue_accept (sk)) !=NULL ) { -__vsock_release (pending,SINGLE_DEPTH_NESTING ); -sock_put (pending); - } +if (vsk->transport) + vsk->transport->release (vsk); +else if (sk->sk_type ==SOCK_STREAM ) +vsock_remove_sock (vsk); -release_sock (sk); -sock_put (sk); +sock_orphan (sk); + sk->sk_shutdown =SHUTDOWN_MASK ; + +skb_queue_purge (&sk->sk_receive_queue); + +/* Clean up any sockets that never were accepted. */ +while ((pending =vsock_dequeue_accept (sk)) !=NULL ) { +__vsock_release (pending,SINGLE_DEPTH_NESTING ); +sock_put (pending); } + +release_sock (sk); +sock_put (sk); }static void vsock_sk_destruct (struct sock *sk)
@@ -853,9 +853,22 @@ s64 vsock_stream_has_space(struct vsock_ }EXPORT_SYMBOL_GPL (vsock_stream_has_space); +/* Dummy callback required by sockmap. +* See unconditional call of saved_close() in sock_map_close(). +*/ +static void vsock_close (struct sock *sk,long timeout) +{ +} +static int vsock_release (struct socket *sock) { -__vsock_release (sock->sk,0 ); +struct sock *sk = sock->sk; + +if (!sk) +return 0 ; + + sk->sk_prot->close (sk,0 ); +__vsock_release (sk,0 ); sock->sk =NULL ; sock->state =SS_FREE ;
Greg Kroah-Hartman
maintainerPATCH 453/462 vsock: Keep the binding until socket destruction
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
commit fcdd2242c0231032fc84e1404315c245ae56322a upstream.
Preserve sockets bindings; this includes both resulting from an explicit bind() and those implicitly bound through autobind during connect().
Prevents socket unbinding during a transport reassignment, which fixes a use-after-free:
1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (refcnt=2)
2. transport->release() calls vsock_remove_bound() without checking if sk was bound and moved to bound list (refcnt=1)
3. vsock_bind() assumes sk is in unbound list and before __vsock_insert_bound(vsock_bound_sockets()) calls __vsock_remove_bound() which does:
list_del_init(&vsk->bound_table); // nop
sock_put(&vsk->sk); // refcnt=0
BUG: KASAN: slab-use-after-free in __vsock_bind+0x62e/0x730 Read of size 4 at addr ffff88816b46a74c by task a.out/2057 dump_stack_lvl+0x68/0x90 print_report+0x174/0x4f6 kasan_report+0xb9/0x190 __vsock_bind+0x62e/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 __kasan_slab_alloc+0x85/0x90 kmem_cache_alloc_noprof+0x131/0x450 sk_prot_alloc+0x5b/0x220 sk_alloc+0x2c/0x870 __vsock_create.constprop.0+0x2e/0xb60 vsock_create+0xe4/0x420 __sock_create+0x241/0x650 __sys_socket+0xf2/0x1a0 __x64_sys_socket+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 kasan_save_free_info+0x37/0x60 __kasan_slab_free+0x4b/0x70 kmem_cache_free+0x1a1/0x590 __sk_destruct+0x388/0x5a0 __vsock_bind+0x5e1/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 7 PID: 2057 at lib/refcount.c:25 refcount_warn_saturate+0xce/0x150 RIP: 0010:refcount_warn_saturate+0xce/0x150 __vsock_bind+0x66d/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
refcount_t: underflow; use-after-free.
WARNING: CPU: 7 PID: 2057 at lib/refcount.c:28 refcount_warn_saturate+0xee/0x150 RIP: 0010:refcount_warn_saturate+0xee/0x150 vsock_remove_bound+0x187/0x1e0 __vsock_release+0x383/0x4a0 vsock_release+0x90/0x120 __sock_release+0xa3/0x250 sock_close+0x14/0x20 __fput+0x359/0xa80 task_work_run+0x107/0x1d0 do_exit+0x847/0x2560 do_group_exit+0xb8/0x250 __x64_sys_exit_group+0x3a/0x50 x64_sys_call+0xfec/0x14f0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/vmw_vsock/af_vsock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/vmw_vsock/af_vsock.c +6 -2
@@ -330,7 +330,10 @@ EXPORT_SYMBOL_GPL(vsock_find_connected_svoid vsock_remove_sock (struct vsock_sock *vsk) { -vsock_remove_bound (vsk); +/* Transport reassignment must not remove the binding. */ +if (sock_flag (sk_vsock (vsk),SOCK_DEAD )) +vsock_remove_bound (vsk); +vsock_remove_connected (vsk); }EXPORT_SYMBOL_GPL (vsock_remove_sock);
@@ -782,12 +785,13 @@ static void __vsock_release(struct sock*/ lock_sock_nested (sk, level); +sock_orphan (sk); +if (vsk->transport) vsk->transport->release (vsk);else if (sk->sk_type ==SOCK_STREAM )vsock_remove_sock (vsk); -sock_orphan (sk); sk->sk_shutdown =SHUTDOWN_MASK ;skb_queue_purge (&sk->sk_receive_queue);
Greg Kroah-Hartman
maintainerPATCH 454/462 vsock: Orphan socket after transport release
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
commit 78dafe1cf3afa02ed71084b350713b07e72a18fb upstream.
During socket release, sock_orphan() is called without considering that it sets sk->sk_wq to NULL. Later, if SO_LINGER is enabled, this leads to a null pointer dereferenced in virtio_transport_wait_close().
Orphan the socket only after transport release.
Partially reverts the 'Fixes:' commit.
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] lock_acquire+0x19e/0x500 _raw_spin_lock_irqsave+0x47/0x70 add_wait_queue+0x46/0x230 virtio_transport_release+0x4e7/0x7f0 __vsock_release+0xfd/0x490 vsock_release+0x90/0x120 __sock_release+0xa3/0x250 sock_close+0x14/0x20 __fput+0x35e/0xa90 __x64_sys_close+0x78/0xd0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/vmw_vsock/af_vsock.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/vmw_vsock/af_vsock.c +7 -1
@@ -785,13 +785,19 @@ static void __vsock_release(struct sock*/ lock_sock_nested (sk, level); -sock_orphan (sk); +/* Indicate to vsock_remove_sock() that the socket is being released and +* can be removed from the bound_table. Unlike transport reassignment +* case, where the socket must remain bound despite vsock_remove_sock() +* being called from the transport release() callback. +*/ +sock_set_flag (sk,SOCK_DEAD );if (vsk->transport) vsk->transport->release (vsk);else if (sk->sk_type ==SOCK_STREAM )vsock_remove_sock (vsk); +sock_orphan (sk); sk->sk_shutdown =SHUTDOWN_MASK ;skb_queue_purge (&sk->sk_receive_queue);
Greg Kroah-Hartman
maintainerPATCH 455/462 sched: sch_cake: add bounds checks to host bulk flow fairness counts
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
commit 737d4d91d35b5f7fa5bb442651472277318b0bfd upstream.
Even though we fixed a logic error in the commit cited below, syzbot still managed to trigger an underflow of the per-host bulk flow counters, leading to an out of bounds memory access.
To avoid any such logic errors causing out of bounds memory accesses, this commit factors out all accesses to the per-host bulk flow counters to a series of helpers that perform bounds-checking before any increments and decrements. This also has the benefit of improving readability by moving the conditional checks for the flow mode into these helpers, instead of having them spread out throughout the code (which was the cause of the original logic error).
As part of this change, the flow quantum calculation is consolidated into a helper function, which means that the dithering applied to the ost load scaling is now applied both in the DRR rotation and when a sparse flow's quantum is first initiated. The only user-visible effect of this is that the maximum packet size that can be sent while a flow stays sparse will now vary with +/- one byte in some cases. This should not make a noticeable difference in practice, and thus it's not worth complicating the code to preserve the old behaviour.
--- net/sched/sch_cake.c | 140 +++++++++++++++++++++++++++------------------------ 1 file changed, 75 insertions(+), 65 deletions(-)
net/sched/sch_cake.c +75 -65
@@ -643,6 +643,63 @@ static bool cake_ddst(int flow_mode)return (flow_mode &CAKE_FLOW_DUAL_DST ) ==CAKE_FLOW_DUAL_DST ; } +static void cake_dec_srchost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_dsrc (flow_mode) && + q->hosts[flow->srchost].srchost_bulk_flow_count)) + q->hosts[flow->srchost].srchost_bulk_flow_count--; +} + +static void cake_inc_srchost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_dsrc (flow_mode) && + q->hosts[flow->srchost].srchost_bulk_flow_count <CAKE_QUEUES )) + q->hosts[flow->srchost].srchost_bulk_flow_count++; +} + +static void cake_dec_dsthost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_ddst (flow_mode) && + q->hosts[flow->dsthost].dsthost_bulk_flow_count)) + q->hosts[flow->dsthost].dsthost_bulk_flow_count--; +} + +static void cake_inc_dsthost_bulk_flow_count (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +if (likely (cake_ddst (flow_mode) && + q->hosts[flow->dsthost].dsthost_bulk_flow_count <CAKE_QUEUES )) + q->hosts[flow->dsthost].dsthost_bulk_flow_count++; +} + +static u16 cake_get_flow_quantum (struct cake_tin_data *q, +struct cake_flow *flow, +int flow_mode) +{ +u16 host_load =1 ; + +if (cake_dsrc (flow_mode)) + host_load =max (host_load, + q->hosts[flow->srchost].srchost_bulk_flow_count); + +if (cake_ddst (flow_mode)) + host_load =max (host_load, + q->hosts[flow->dsthost].dsthost_bulk_flow_count); + +/* The shifted prandom_u32() is a way to apply dithering to avoid +* accumulating roundoff errors +*/ +return (q->flow_quantum * quantum_div[host_load] + + (prandom_u32 () >>16 )) >>16 ; +} +static u32 cake_hash (struct cake_tin_data *q,const struct sk_buff *skb,int flow_mode,u16 flow_override,u16 host_override) {
@@ -789,10 +846,8 @@ skip_hash: allocate_dst =cake_ddst (flow_mode);if (q->flows[outer_hash + k].set ==CAKE_SET_BULK ) { -if (allocate_src) - q->hosts[q->flows[reduced_hash].srchost].srchost_bulk_flow_count--; -if (allocate_dst) - q->hosts[q->flows[reduced_hash].dsthost].dsthost_bulk_flow_count--; +cake_dec_srchost_bulk_flow_count (q, &q->flows[outer_hash + k], flow_mode); +cake_dec_dsthost_bulk_flow_count (q, &q->flows[outer_hash + k], flow_mode); } found:/* reserve queue for future packets in same flow */
@@ -817,9 +872,10 @@ found: q->hosts[outer_hash + k].srchost_tag = srchost_hash; found_src: srchost_idx = outer_hash + k; -if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) - q->hosts[srchost_idx].srchost_bulk_flow_count++; q->flows[reduced_hash].srchost = srchost_idx; + +if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) +cake_inc_srchost_bulk_flow_count (q, &q->flows[reduced_hash], flow_mode); }if (allocate_dst) {
@@ -840,9 +896,10 @@ found_src: q->hosts[outer_hash + k].dsthost_tag = dsthost_hash; found_dst: dsthost_idx = outer_hash + k; -if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) - q->hosts[dsthost_idx].dsthost_bulk_flow_count++; q->flows[reduced_hash].dsthost = dsthost_idx; + +if (q->flows[reduced_hash].set ==CAKE_SET_BULK ) +cake_inc_dsthost_bulk_flow_count (q, &q->flows[reduced_hash], flow_mode); } }
@@ -1855,10 +1912,6 @@ static s32 cake_enqueue(struct sk_buff */* flowchain */ if (!flow->set || flow->set ==CAKE_SET_DECAYING ) { -struct cake_host *srchost = &b->hosts[flow->srchost]; -struct cake_host *dsthost = &b->hosts[flow->dsthost]; -u16 host_load =1 ; -if (!flow->set) {list_add_tail (&flow->flowchain, &b->new_flows); }else {
@@ -1868,18 +1921,8 @@ static s32 cake_enqueue(struct sk_buff * flow->set =CAKE_SET_SPARSE ; b->sparse_flow_count++; -if (cake_dsrc (q->flow_mode)) - host_load =max (host_load, srchost->srchost_bulk_flow_count); - -if (cake_ddst (q->flow_mode)) - host_load =max (host_load, dsthost->dsthost_bulk_flow_count); - - flow->deficit = (b->flow_quantum * - quantum_div[host_load]) >>16 ; + flow->deficit =cake_get_flow_quantum (b, flow, q->flow_mode); }else if (flow->set ==CAKE_SET_SPARSE_WAIT ) { -struct cake_host *srchost = &b->hosts[flow->srchost]; -struct cake_host *dsthost = &b->hosts[flow->dsthost]; -/* this flow was empty, accounted as a sparse flow, but actually * in the bulk rotation. */
@@ -1887,12 +1930,8 @@ static s32 cake_enqueue(struct sk_buff * b->sparse_flow_count--; b->bulk_flow_count++; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count++; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count++; - +cake_inc_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_inc_dsthost_bulk_flow_count (b, flow, q->flow_mode); }if (q->buffer_used > q->buffer_max_used)
@@ -1949,13 +1988,11 @@ static struct sk_buff *cake_dequeue(stru {struct cake_sched_data *q =qdisc_priv (sch);struct cake_tin_data *b = &q->tins[q->cur_tin]; -struct cake_host *srchost, *dsthost;ktime_t now =ktime_get ();struct cake_flow *flow;struct list_head *head;bool first_flow = true;struct sk_buff *skb; -u16 host_load;u64 delay;u32 len;
@@ -2055,11 +2092,6 @@ retry: q->cur_flow = flow - b->flows; first_flow = false; -/* triple isolation (modified DRR++) */ - srchost = &b->hosts[flow->srchost]; - dsthost = &b->hosts[flow->dsthost]; - host_load =1 ; -/* flow isolation (DRR++) */ if (flow->deficit <=0 ) {/* Keep all flows with deficits out of the sparse and decaying
@@ -2071,11 +2103,8 @@ retry: b->sparse_flow_count--; b->bulk_flow_count++; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count++; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count++; +cake_inc_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_inc_dsthost_bulk_flow_count (b, flow, q->flow_mode); flow->set =CAKE_SET_BULK ; }else {
@@ -2087,19 +2116,7 @@ retry: } } -if (cake_dsrc (q->flow_mode)) - host_load =max (host_load, srchost->srchost_bulk_flow_count); - -if (cake_ddst (q->flow_mode)) - host_load =max (host_load, dsthost->dsthost_bulk_flow_count); - -WARN_ON (host_load >CAKE_QUEUES ); - -/* The shifted prandom_u32() is a way to apply dithering to -* avoid accumulating roundoff errors -*/ - flow->deficit += (b->flow_quantum * quantum_div[host_load] + - (prandom_u32 () >>16 )) >>16 ; + flow->deficit +=cake_get_flow_quantum (b, flow, q->flow_mode);list_move_tail (&flow->flowchain, &b->old_flows); goto retry;
@@ -2123,11 +2140,8 @@ retry:if (flow->set ==CAKE_SET_BULK ) { b->bulk_flow_count--; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count--; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count--; +cake_dec_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_dec_dsthost_bulk_flow_count (b, flow, q->flow_mode); b->decaying_flow_count++; } else if (flow->set == CAKE_SET_SPARSE ||
@@ -2145,12 +2159,8 @@ retry:else if (flow->set ==CAKE_SET_BULK ) { b->bulk_flow_count--; -if (cake_dsrc (q->flow_mode)) - srchost->srchost_bulk_flow_count--; - -if (cake_ddst (q->flow_mode)) - dsthost->dsthost_bulk_flow_count--; - +cake_dec_srchost_bulk_flow_count (b, flow, q->flow_mode); +cake_dec_dsthost_bulk_flow_count (b, flow, q->flow_mode); }else b->decaying_flow_count--;
Greg Kroah-Hartman
maintainerPATCH 456/462 kbuild: userprogs: use correct lld when linking through clang
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Thomas Wei�schuh" <[email protected]>
commit dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 upstream.
The userprog infrastructure links objects files through $(CC). Either explicitly by manually calling $(CC) on multiple object files or implicitly by directly compiling a source file to an executable. The documentation at Documentation/kbuild/llvm.rst indicates that ld.lld would be used for linking if LLVM=1 is specified.
However clang instead will use either a globally installed cross linker from $PATH called ${target}-ld or fall back to the system linker, which probably does not support crosslinking.
For the normal kernel build this is not an issue because the linker is always executed directly, without the compiler being involved.
Explicitly pass --ld-path to clang so $(LD) is respected.
As clang 13.0.1 is required to build the kernel, this option is available.
[nathan: use cc-option for 6.6 and older, as those trees support back to
clang-11]
--- Makefile | 5 +++++ 1 file changed, 5 insertions(+)
Makefile +5 -0
@@ -1022,6 +1022,11 @@ endif KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) +# userspace programs are linked via the compiler, use the correct linker +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy) +KBUILD_USERLDFLAGS += $(call cc-option, --ld-path=$(LD)) +endif + # make the checker run with the right architecture CHECKFLAGS += --arch=$(ARCH)
Greg Kroah-Hartman
maintainerPATCH 457/462 crypto: hisilicon/qm - inject error before stopping queue
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weili Qian <[email protected]>
commit b04f06fc0243600665b3b50253869533b7938468 upstream.
The master ooo cannot be completely closed when the accelerator core reports memory error. Therefore, the driver needs to inject the qm error to close the master ooo. Currently, the qm error is injected after stopping queue, memory may be released immediately after stopping queue, causing the device to access the released memory. Therefore, error is injected to close master ooo before stopping queue to ensure that the device does not access the released memory.
--- drivers/crypto/hisilicon/qm.c | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/crypto/hisilicon/qm.c +23 -23
@@ -3354,6 +3354,27 @@ static int qm_set_vf_mse(struct hisi_qmreturn -ETIMEDOUT ; } +static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) +{ +u32 nfe_enb =0 ; + +if (!qm->err_status.is_dev_ecc_mbit && + qm->err_status.is_qm_ecc_mbit && + qm->err_ini->close_axi_master_ooo) { + + qm->err_ini->close_axi_master_ooo (qm); + + }else if (qm->err_status.is_dev_ecc_mbit && + !qm->err_status.is_qm_ecc_mbit && + !qm->err_ini->close_axi_master_ooo) { + + nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); +writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , + qm->io_base +QM_RAS_NFE_ENABLE ); +writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); + } +} +static int qm_set_msi (struct hisi_qm *qm,bool set) {struct pci_dev *pdev = qm->pdev;
@@ -3433,6 +3454,8 @@ static int qm_controller_reset_prepare(sreturn ret; } +qm_dev_ecc_mbit_handle (qm); +if (qm->vfs_num) { ret =qm_vf_reset_prepare (qm,QM_SOFT_RESET );if (ret) {
@@ -3450,27 +3473,6 @@ static int qm_controller_reset_prepare(sreturn 0 ; } -static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) -{ -u32 nfe_enb =0 ; - -if (!qm->err_status.is_dev_ecc_mbit && - qm->err_status.is_qm_ecc_mbit && - qm->err_ini->close_axi_master_ooo) { - - qm->err_ini->close_axi_master_ooo (qm); - - }else if (qm->err_status.is_dev_ecc_mbit && - !qm->err_status.is_qm_ecc_mbit && - !qm->err_ini->close_axi_master_ooo) { - - nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); -writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , - qm->io_base +QM_RAS_NFE_ENABLE ); -writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); - } -} -static int qm_soft_reset (struct hisi_qm *qm) {struct pci_dev *pdev = qm->pdev;
@@ -3496,8 +3498,6 @@ static int qm_soft_reset(struct hisi_qmreturn ret; } -qm_dev_ecc_mbit_handle (qm); -/* OOO register set and check */ writel (ACC_MASTER_GLOBAL_CTRL_SHUTDOWN , qm->io_base +ACC_MASTER_GLOBAL_CTRL );
Greg Kroah-Hartman
maintainerPATCH 458/462 btrfs: bring back the incorrectly removed extent buffer lock recursion support
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
Commit 51b03b7473a0 ("btrfs: locking: remove the recursion handling code") from the 5.10.233 stable tree removed the support for extent buffer lock recursion, but we need that code because in 5.10.x we load the free space cache synchronously - while modifying the extent tree and holding a write lock on some extent buffer, we may need to load the free space cache, which requires acquiring read locks on the extent tree and therefore result in a deadlock in case we need to read lock an extent buffer we had write locked while modifying the extent tree.
Backporting that commit from Linus' tree is therefore wrong, and was done so in order to backport upstream commit 97e86631bccd ("btrfs: don't set lock_owner when locking extent buffer for reading"). However we should have instead had the commit adapted to the 5.10 stable tree instead.
Note that the backport of that dependency is ok only for stable trees 5.11+, because in those tree the space cache loading code is not synchronous anymore, so there is no need to have the lock recursion and indeed there are no users of the extent buffer lock recursion support. In other words, the backport is only valid for kernel releases that have the asynchrounous free space cache loading support, which was introduced in kernel 5.11 with commit e747853cae3a ("btrfs: load free space cache asynchronously").
This was causing deadlocks and reported by a user (see below Link tag).
So revert commit 51b03b7473a0 ("btrfs: locking: remove the recursion handling code") while not undoing what commit d5a30a6117ea ("btrfs: don't set lock_owner when locking extent buffer for reading") from the 5.10.x stable tree did.
--- fs/btrfs/locking.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 4 deletions(-)
fs/btrfs/locking.c +64 -4
@@ -25,18 +25,43 @@* - reader/reader sharing * - try-lock semantics for readers and writers * -* The rwsem implementation does opportunistic spinning which reduces number of -* times the locking task needs to sleep. +* Additionally we need one level nesting recursion, see below. The rwsem +* implementation does opportunistic spinning which reduces number of times the +* locking task needs to sleep. +* +* +* Lock recursion +* -------------- +* +* A write operation on a tree might indirectly start a look up on the same +* tree. This can happen when btrfs_cow_block locks the tree and needs to +* lookup free extents. +* +* btrfs_cow_block +* .. +* alloc_tree_block_no_bg_flush +* btrfs_alloc_tree_block +* btrfs_reserve_extent +* .. +* load_free_space_cache +* .. +* btrfs_lookup_file_extent +* btrfs_search_slot +* */ /* * __btrfs_tree_read_lock - lock extent buffer for read * @eb: the eb to be locked * @nest: the nesting level to be used for lockdep -* @recurse: unused +* @recurse: if this lock is able to be recursed * * This takes the read lock on the extent buffer, using the specified nesting * level for lockdep purposes. +* +* If you specify recurse = true, then we will allow this to be taken if we +* currently own the lock already. This should only be used in specific +* usecases, and the subsequent unlock will not change the state of the lock. */ void __btrfs_tree_read_lock (struct extent_buffer *eb,enum btrfs_lock_nesting nest,bool recurse)
@@ -46,7 +71,31 @@ void __btrfs_tree_read_lock(struct extenif (trace_btrfs_tree_read_lock_enabled ()) start_ns =ktime_get_ns (); +if (unlikely (recurse)) { +/* First see if we can grab the lock outright */ +if (down_read_trylock (&eb->lock)) + goto out; + +/* +* Ok still doesn't necessarily mean we are already holding the +* lock, check the owner. +*/ +if (eb->lock_owner != current->pid) { +down_read_nested (&eb->lock, nest); + goto out; + } + +/* +* Ok we have actually recursed, but we should only be recursing +* once, so blow up if we're already recursed, otherwise set +* ->lock_recursed and carry on. +*/ +BUG_ON (eb->lock_recursed); + eb->lock_recursed = true; + goto out; + }down_read_nested (&eb->lock, nest); +out:trace_btrfs_tree_read_lock (eb, start_ns); }
@@ -85,11 +134,22 @@ int btrfs_try_tree_write_lock(struct ext }/* -* Release read lock. +* Release read lock. If the read lock was recursed then the lock stays in the +* original state that it was before it was recursively locked. */ void btrfs_tree_read_unlock (struct extent_buffer *eb) {trace_btrfs_tree_read_unlock (eb); +/* +* if we're nested, we have the write lock. No new locking +* is needed as long as we are the lock owner. +* The write unlock will do a barrier for us, and the lock_recursed +* field only matters to the lock owner. +*/ +if (eb->lock_recursed && current->pid == eb->lock_owner) { + eb->lock_recursed = false; +return ; + }up_read (&eb->lock); }
Greg Kroah-Hartman
maintainerPATCH 459/462 usb: xhci: Enable the TRB overfetch quirk on VIA VL805
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit c133ec0e5717868c9967fa3df92a55e537b1aead upstream.
Raspberry Pi is a major user of those chips and they discovered a bug - when the end of a transfer ring segment is reached, up to four TRBs can be prefetched from the next page even if the segment ends with link TRB and on page boundary (the chip claims to support standard 4KB pages).
It also appears that if the prefetched TRBs belong to a different ring whose doorbell is later rung, they may be used without refreshing from system RAM and the endpoint will stay idle if their cycle bit is stale.
Other users complain about IOMMU faults on x86 systems, unsurprisingly.
Deal with it by using existing quirk which allocates a dummy page after each transfer ring segment. This was seen to resolve both problems. RPi came up with a more efficient solution, shortening each segment by four TRBs, but it complicated the driver and they ditched it for this quirk.
Also rename the quirk and add VL805 device ID macro.
--- drivers/usb/host/xhci-mem.c | 3 ++- drivers/usb/host/xhci-pci.c | 9 ++++++--- drivers/usb/host/xhci.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mem.c +2 -1
@@ -2494,7 +2494,8 @@ int xhci_mem_init(struct xhci_hcd *xhci,* and our use of dma addresses in the trb_address_map radix tree needs * TRB_SEGMENT_SIZE alignment, so we pick the greater alignment need. */ -if (xhci->quirks &XHCI_ZHAOXIN_TRB_FETCH ) +if (xhci->quirks &XHCI_TRB_OVERFETCH ) +/* Buggy HC prefetches beyond segment bounds - allocate dummy space at the end */ xhci->segment_pool =dma_pool_create ("xHCI ring segments" , dev,TRB_SEGMENT_SIZE *2 ,TRB_SEGMENT_SIZE *2 , xhci->page_size *2 );else
drivers/usb/host/xhci-pci.c +6 -3
@@ -37,6 +37,8 @@#define PCI_DEVICE_ID_EJ168 0x7023#define PCI_DEVICE_ID_EJ188 0x7052 +#define PCI_DEVICE_ID_VIA_VL805 0x3483 +#define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31#define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI 0x9cb1
@@ -296,8 +298,9 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x3432) xhci->quirks |=XHCI_BROKEN_STREAMS ; -if (pdev->vendor ==PCI_VENDOR_ID_VIA && pdev->device ==0x3483 ) { +if (pdev->vendor ==PCI_VENDOR_ID_VIA && pdev->device ==PCI_DEVICE_ID_VIA_VL805 ) { xhci->quirks |=XHCI_LPM_SUPPORT ; + xhci->quirks |=XHCI_TRB_OVERFETCH ; xhci->quirks |=XHCI_EP_CTX_BROKEN_DCS ; }
@@ -347,11 +350,11 @@ static void xhci_pci_quirks(struct devicif (pdev->device ==0x9202 ) { xhci->quirks |=XHCI_RESET_ON_RESUME ; - xhci->quirks |=XHCI_ZHAOXIN_TRB_FETCH ; + xhci->quirks |=XHCI_TRB_OVERFETCH ; }if (pdev->device ==0x9203 ) - xhci->quirks |=XHCI_ZHAOXIN_TRB_FETCH ; + xhci->quirks |=XHCI_TRB_OVERFETCH ; }/* xHC spec requires PCI devices to support D3hot and D3cold */
drivers/usb/host/xhci.h +1 -1
@@ -1902,7 +1902,7 @@ struct xhci_hcd {#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)#define XHCI_RESET_TO_DEFAULT BIT_ULL(44) -#define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) +#define XHCI_TRB_OVERFETCH BIT_ULL(45)#define XHCI_ZHAOXIN_HOST BIT_ULL(46)unsigned int num_active_eps;
Greg Kroah-Hartman
maintainerPATCH 460/462 perf cs-etm: Add missing variable in cs_etm__process_queues()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit 5afd032961e8 "perf cs-etm: Don't flush when packet_queue fills up" uses i as a loop counter in cs_etm__process_queues(). It was backported to the 5.4 and 5.10 stable branches, but the i variable doesn't exist there as it was only added in 5.15.
Declare i with the expected type.
--- tools/perf/util/cs-etm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/cs-etm.c +1 -1
@@ -2171,7 +2171,7 @@ static int cs_etm__process_timeless_queustatic int cs_etm__process_queues (struct cs_etm_auxtrace *etm) {int ret =0 ; -unsigned int cs_queue_nr, queue_nr; +unsigned int cs_queue_nr, queue_nr, i;u8 trace_chan_id;u64 timestamp;struct auxtrace_queue *queue;
Greg Kroah-Hartman
maintainerPATCH 461/462 udf: Fix use of check_add_overflow() with mixed type arguments
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit ebbe26fd54a9 "udf: Avoid excessive partition lengths" introduced a use of check_add_overflow() with argument types u32, size_t, and u32 *.
This was backported to the 5.x stable branches, where in 64-bit configurations it results in a build error (with older compilers) or a warning. Before commit d219d2a9a92e "overflow: Allow mixed type arguments", which went into Linux 6.1, mixed type arguments are not supported. That cannot be backported to 5.4 or 5.10 as it would raise the minimum compiler version for these kernel versions.
Add a cast to make the argument types compatible.
--- fs/udf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/super.c +1 -1
@@ -1153,7 +1153,7 @@ static int udf_fill_partdesc_info(struct map->s_partition_flags |=UDF_PART_FLAG_UNALLOC_BITMAP ;/* Check whether math over bitmap won't overflow. */ if (check_add_overflow (map->s_partition_len, -sizeof (struct spaceBitmapDesc ) <<3 , + (u32)(sizeof (struct spaceBitmapDesc ) <<3 ), &sum)) {udf_err (sb,"Partition %d is too long (%u)\n" , p_index, map->s_partition_len);
Greg Kroah-Hartman
maintainerPATCH 462/462 net: ipv6: fix dst refleaks in rpl, seg6 and ioam6 lwtunnels
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit c71a192976ded2f2f416d03c4f595cdd4478b825 upstream.
dst_cache_get() gives us a reference, we need to release it.
Discovered by the ioam6.sh test, kmemleak was recently fixed to catch per-cpu memory leaks.
--- net/ipv6/rpl_iptunnel.c | 6 ++++-- net/ipv6/seg6_iptunnel.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
net/ipv6/rpl_iptunnel.c +4 -2
@@ -232,7 +232,6 @@ static int rpl_output(struct net *net, s dst =ip6_route_output (net,NULL , &fl6);if (dst->error) { err = dst->error; -dst_release (dst); goto drop; }
@@ -251,6 +250,7 @@ static int rpl_output(struct net *net, sreturn dst_output (net, sk, skb); drop: +dst_release (dst);kfree_skb (skb);return err; }
@@ -277,8 +277,10 @@ static int rpl_input(struct sk_buff *skblocal_bh_enable (); err =rpl_do_srh (skb, rlwt, dst); -if (unlikely (err)) +if (unlikely (err)) { +dst_release (dst); goto drop; + }skb_dst_drop (skb);
net/ipv6/seg6_iptunnel.c +1 -1
@@ -380,7 +380,6 @@ static int seg6_output(struct net *net, dst =ip6_route_output (net,NULL , &fl6);if (dst->error) { err = dst->error; -dst_release (dst); goto drop; }
@@ -398,6 +397,7 @@ static int seg6_output(struct net *net,return dst_output (net, sk, skb); drop: +dst_release (dst);kfree_skb (skb);return err; }
Re: [PATCH 5.10 462/462] net: ipv6: fix dst refleaks in rpl, seg6 and ioam6 lwtunnels
Quoted 6 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
Quoted 8 lines
commit
c71a192976ded2f2f416d03c4f595cdd4478b825upstream.
dst_cache_get()gives us a reference, we need to release it.Discovered by the
ioam6.shtest, kmemleak was recently fixed to catch per-cpu memory leaks.Fixes 985ec6f5e623 ("net: ipv6: rpl_iptunnel: mitigate 2-realloc issue")
The 5.10 branch does not include backports of:
Quoted 2 lines
Fixes 40475b63761a ("net: ipv6: seg6_iptunnel: mitigate 2-realloc issue")Fixes dce525185bc9 ("net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue")
so the changes this makes to seg6_iptunnel.c are incorrect and appear to introduce a UAF.
Ben.
Quoted 60 lines
Reviewed-by Justin Iurman <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by Jakub Kicinski <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/ipv6/rpl_iptunnel.c | 6 ++++-- net/ipv6/seg6_iptunnel.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)net/ipv6/rpl_iptunnel.c +4
-2@@ -232,7 +232,6 @@ static int rpl_output(struct net *net, s dst =ip6_route_output (net,NULL , &fl6);if (dst->error) { err = dst->error; -dst_release (dst); goto drop; }@@ -251,6 +250,7 @@ static int rpl_output(struct net *net, sreturn dst_output (net, sk, skb); drop: +dst_release (dst);kfree_skb (skb);return err; }@@ -277,8 +277,10 @@ static int rpl_input(struct sk_buff *skblocal_bh_enable (); err =rpl_do_srh (skb, rlwt, dst); -if (unlikely (err)) +if (unlikely (err)) { +dst_release (dst); goto drop; + }skb_dst_drop (skb);net/ipv6/seg6_iptunnel.c +1
-1@@ -380,7 +380,6 @@ static int seg6_output(struct net *net, dst =ip6_route_output (net,NULL , &fl6);if (dst->error) { err = dst->error; -dst_release (dst); goto drop; }@@ -398,6 +397,7 @@ static int seg6_output(struct net *net,return dst_output (net, sk, skb); drop: +dst_release (dst);kfree_skb (skb);return err; }
Signature · 2 lines
Ben Hutchings If at first you don't succeed, you're doing about average.
Greg Kroah-Hartman
maintainerRe: [PATCH 5.10 462/462] net: ipv6: fix dst refleaks in rpl, seg6 and ioam6 lwtunnels
Quoted 16 lines · Ben Hutchings
Quoted 6 lines · Greg Kroah-Hartman
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
Quoted 8 lines
commit
c71a192976ded2f2f416d03c4f595cdd4478b825upstream.
dst_cache_get()gives us a reference, we need to release it.Discovered by the
ioam6.shtest, kmemleak was recently fixed to catch per-cpu memory leaks.Fixes 985ec6f5e623 ("net: ipv6: rpl_iptunnel: mitigate 2-realloc issue")
Quoted 7 lines
The 5.10 branch does not include backports of:
Quoted 2 lines
Fixes 40475b63761a ("net: ipv6: seg6_iptunnel: mitigate 2-realloc issue")Fixes dce525185bc9 ("net: ipv6: ioam6_iptunnel: mitigate 2-realloc issue")so the changes this makes to
seg6_iptunnel.care incorrect and appear to introduce a UAF.
Ick. Should I just revert it?
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.235 release. There are 462 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 13 Mar 2025 14:56:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.235-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Same thing as with the 5.4 kernel, "udp: gso: do not drop small packets when PMTU reduces" needs to use min_t() instead. Thanks!
Signature · 1 line
Florian
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.235 release. There are 462 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg Kroah-Hartman wrote on Tue, Mar 11, 2025 at 03:54:26PM +0100:
Quoted 5 lines
This is the start of the stable review cycle for the 5.10.235 release. There are 462 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Thu, 13 Mar 2025 14:56:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.235-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.
Tested 92c950d96187 ("Linux 5.10.235-rc1") on:
- arm i.MX6ULL (Armadillo 640)
- arm64 i.MX8MP (Armadillo G4)
No obvious regression in dmesg or basic tests:
Signature · 1 line
Dominique Martinet
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.235 release. There are 462 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 13 Mar 2025 14:56:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.235-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
NOTE:
The following build errors noticed on arm, arm64 and x86 builds
net/ipv4/udp.c: In function 'udp_send_skb':include/linux/minmax.h:20:35: warning: comparison of distinct pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
Link:
- https://storage.tuxsuite.com/public/linaro/anders/builds/2uDdzxpnkQaVOXPsetXcyEGCkjq/
## Build
* kernel: 5.10.235-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: 92c950d96187151bf683889647407b8869ea4641
* git describe: v5.10.234-463-g92c950d96187
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.234-463-g92c950d96187
## Test Regressions (compared to v5.10.233-137-g99689d3bdd98)
## Metric Regressions (compared to v5.10.233-137-g99689d3bdd98)
## Test Fixes (compared to v5.10.233-137-g99689d3bdd98)
## Metric Fixes (compared to v5.10.233-137-g99689d3bdd98)
## Test result summary
total: 49601, pass: 34341, fail: 3928, skip: 10994, xfail: 338
## Build Summary
* arc: 6 total, 5 passed, 1 failed
* arm: 105 total, 105 passed, 0 failed
* arm64: 32 total, 32 passed, 0 failed
* i386: 25 total, 25 passed, 0 failed
* mips: 25 total, 22 passed, 3 failed
* parisc: 4 total, 0 passed, 4 failed
* powerpc: 24 total, 23 passed, 1 failed
* riscv: 12 total, 12 passed, 0 failed
* s390: 12 total, 12 passed, 0 failed
* sh: 11 total, 10 passed, 1 failed
* sparc: 8 total, 7 passed, 1 failed
* x86_64: 29 total, 29 passed, 0 failed
## Test suites summary
* boot
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org