)]}'
{
  "commit": "f1f5c8a3955f8fda3f84ed883ac8daa1847e724c",
  "tree": "593665a3ba267e5df5a898e07dde3ef422bf9cab",
  "parents": [
    "d2e914a4a0d0f753dbae830264850d044026167c"
  ],
  "author": {
    "name": "Jamal Hadi Salim",
    "email": "jhs@mojatatu.com",
    "time": "Sat Jul 11 11:05:37 2026 -0400"
  },
  "committer": {
    "name": "Paolo Abeni",
    "email": "pabeni@redhat.com",
    "time": "Fri Jul 17 12:13:20 2026 +0200"
  },
  "message": "net/sched: act_tunnel_key: Defer dst_release to RCU callback\n\nFix a race-condition use-after-free in tunnel_key_release_params().\n\nThe function releases the metadata_dst of the old params synchronously\nvia dst_release() while deferring the params struct free with\nkfree_rcu(). A concurrent tunnel_key_act() reader on the datapath may\nstill hold the old params pointer (under rcu_read_lock_bh) and proceed\nto call dst_clone(\u0026params-\u003etcft_enc_metadata-\u003edst) after the writer\u0027s\ndst_release has already pushed the dst\u0027s rcuref to RCUREF_DEAD.\n\nzdi-disclosures@trendmicro.com produced a poc which i (and Victor) verified\nthat KASAN reports:\n\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\nBUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112\nBUG: KASAN: slab-use-after-free in atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:326\nBUG: KASAN: slab-use-after-free in __rcuref_put include/linux/rcuref.h:109\nBUG: KASAN: slab-use-after-free in rcuref_put include/linux/rcuref.h:173\nBUG: KASAN: slab-use-after-free in dst_release+0x5b/0x370 net/core/dst.c:168\nWrite of size 4 at addr ffff88806158de40 by task poc/9388\n\nCPU: 0 UID: 0 PID: 9388 Comm: poc Tainted: G        W           7.1.0-rc7 #7 PREEMPT(lazy)\nTainted: [W]\u003dWARN\nHardware name: QEMU Ubuntu 25.10 PC v2 (i440FX + PIIX, + 10.1 machine, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014\nCall Trace:\n \u003cTASK\u003e\n __dump_stack lib/dump_stack.c:94\n dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120\n print_address_description mm/kasan/report.c:378\n print_report+0x139/0x4ad mm/kasan/report.c:482\n kasan_report+0xe4/0x1d0 mm/kasan/report.c:595\n check_region_inline mm/kasan/generic.c:186\n kasan_check_range+0x125/0x200 mm/kasan/generic.c:200\n instrument_atomic_read_write include/linux/instrumented.h:112\n atomic_sub_return_release include/linux/atomic/atomic-instrumented.h:326\n __rcuref_put include/linux/rcuref.h:109\n rcuref_put include/linux/rcuref.h:173\n dst_release+0x5b/0x370 net/core/dst.c:168\n refdst_drop include/net/dst.h:272\n skb_dst_drop include/net/dst.h:284\n skb_release_head_state+0x293/0x400 net/core/skbuff.c:1163\n skb_release_all net/core/skbuff.c:1187\n[..]\nAllocated by task 9391:\n kasan_save_stack+0x30/0x50 mm/kasan/common.c:57\n kasan_save_track+0x14/0x30 mm/kasan/common.c:78\n poison_kmalloc_redzone mm/kasan/common.c:398\n __kasan_kmalloc+0x9a/0xb0 mm/kasan/common.c:415\n kasan_kmalloc include/linux/kasan.h:263\n __do_kmalloc_node mm/slub.c:5296\n __kmalloc_noprof+0x2f1/0x830 mm/slub.c:5308\n kmalloc_noprof include/linux/slab.h:954\n kzalloc_noprof include/linux/slab.h:1188\n offload_action_alloc+0x2f/0x130 net/core/flow_offload.c:35\n tcf_action_offload_add_ex+0x1ba/0x880 net/sched/act_api.c:258\n tcf_action_offload_add net/sched/act_api.c:293\n tcf_action_init+0x66e/0xa20 net/sched/act_api.c:1547\n tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101\n[..]\nFreed by task 9391:\n kasan_save_stack+0x30/0x50 mm/kasan/common.c:57\n kasan_save_track+0x14/0x30 mm/kasan/common.c:78\n kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584\n poison_slab_object mm/kasan/common.c:253\n __kasan_slab_free+0x6b/0x90 mm/kasan/common.c:285\n kasan_slab_free include/linux/kasan.h:235\n slab_free_hook mm/slub.c:2689\n slab_free mm/slub.c:6251\n kfree+0x21f/0x6b0 mm/slub.c:6566\n tcf_action_offload_add_ex+0x4ad/0x880 net/sched/act_api.c:284\n tcf_action_offload_add net/sched/act_api.c:293\n tcf_action_init+0x66e/0xa20 net/sched/act_api.c:1547\n tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101\n\nThe buggy address belongs to the object at ffff88806158de00\n which belongs to the cache kmalloc-256 of size 256\nThe buggy address is located 64 bytes inside of\n freed 256-byte region [ffff88806158de00, ffff88806158df00)\n\nThe buggy address belongs to the physical page:\npage: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88806158d600 pfn:0x6158c\nhead: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0\nflags: 0x4fff00000000240(workingset|head|node\u003d1|zone\u003d1|lastcpupid\u003d0x7ff)\npage_type: f5(slab)\nraw: 04fff00000000240 ffff88801c841b40 ffffea0001856290 ffffea0001856190\nraw: ffff88806158d600 0000000800100009 00000000f5000000 0000000000000000\nhead: 04fff00000000240 ffff88801c841b40 ffffea0001856290 ffffea0001856190\nhead: ffff88806158d600 0000000800100009 00000000f5000000 0000000000000000\nhead: 04fff00000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff\nhead: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002\npage dumped because: kasan: bad access detected\npage_owner tracks the page as allocated\npage last allocated via order 1, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 9391, tgid 9378 (poc), ts 123227323196, free_ts 0\n set_page_owner include/linux/page_owner.h:32\n post_alloc_hook+0xfe/0x140 mm/page_alloc.c:1853\n prep_new_page mm/page_alloc.c:1861\n get_page_from_freelist+0x110c/0x2fc0 mm/page_alloc.c:3941\n __alloc_frozen_pages_noprof+0x263/0x2bc0 mm/page_alloc.c:5221\n alloc_slab_page mm/slub.c:3278\n allocate_slab mm/slub.c:3467\n new_slab+0xa6/0x690 mm/slub.c:3525\n refill_objects+0x271/0x420 mm/slub.c:7272\n refill_sheaf mm/slub.c:2816\n __pcs_replace_empty_main+0x373/0x630 mm/slub.c:4652\n alloc_from_pcs mm/slub.c:4750\n slab_alloc_node mm/slub.c:4884\n __do_kmalloc_node mm/slub.c:5295\n __kmalloc_noprof+0x66d/0x830 mm/slub.c:5308\n kmalloc_noprof include/linux/slab.h:954\n metadata_dst_alloc+0x26/0x90 net/core/dst.c:298\n tun_rx_dst include/net/dst_metadata.h:144\n __ip_tun_set_dst include/net/dst_metadata.h:208\n tunnel_key_init+0xb01/0x1b90 net/sched/act_tunnel_key.c:451\n tcf_action_init_1+0x46b/0x6c0 net/sched/act_api.c:1428\n tcf_action_init+0x448/0xa20 net/sched/act_api.c:1503\n tcf_action_add+0xf6/0x5d0 net/sched/act_api.c:2101\n[..]\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n\nFix by moving dst_release() into a custom RCU callback that runs\nafter the grace period, matching the lifetime of the containing\nparams struct.  Readers in the datapath therefore always find a live\nrcuref when calling dst_clone().\n\nFixes: 9174c3df1cd18 (\"net/sched: act_tunnel_key: fix memory leak in case of action replace\")\nReported-by: zdi-disclosures@trendmicro.com\nTested-by: Victor Nogueira \u003cvictor@mojatatu.com\u003e\nSigned-off-by: Jamal Hadi Salim \u003cjhs@mojatatu.com\u003e\nReviewed-by: Davide Caratti \u003cdcaratti@redhat.com\u003e\nLink: https://patch.msgid.link/20260711150537.7946-1-jhs@mojatatu.com\nSigned-off-by: Paolo Abeni \u003cpabeni@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "876b30c5709e1f7ac75def6b238f6a097136b218",
      "old_mode": 33188,
      "old_path": "net/sched/act_tunnel_key.c",
      "new_id": "b14807761d829ec174d70efd131b28d12f15ddd8",
      "new_mode": 33188,
      "new_path": "net/sched/act_tunnel_key.c"
    }
  ]
}
