)]}'
{
  "commit": "fee0b300b693f5dcfdc5dd9170a4990558d16640",
  "tree": "16fccb5ef275d3abf7c653bf1dfe64d84b0d8947",
  "parents": [
    "ae12bd0175b218deb33f013587d56e17dcd7d2bb"
  ],
  "author": {
    "name": "Jianbo Liu",
    "email": "jianbol@nvidia.com",
    "time": "Wed Nov 25 03:34:10 2026 +0200"
  },
  "committer": {
    "name": "Steffen Klassert",
    "email": "steffen.klassert@secunet.com",
    "time": "Mon Nov 30 11:36:33 2026 +0100"
  },
  "message": "xfrm: Serialize device state teardown\n\nCommit 89fefad9f971 (\"xfrm: serialize state GC with device state\nflush\") stopped the state GC and xfrm_dev_state_flush() from freeing\nthe same device state at once, but a third caller is not covered.\n\nxfrm_state_find() frees a packet offload acquire state when km_query()\nfails. It runs under RCU and can\u0027t take the mutex.\nxfrm_dev_state_delete() first puts the state on xfrm_state_dev_gc_list\nwith xso-\u003edev still set, so a device flush can find it there and call\nxfrm_dev_state_free() too. Both callers see xso-\u003edev set and both\nunlink the state, so the second hlist_del() hits a poisoned node.\n\nClaim the device in xfrm_dev_state_free() by clearing xso-\u003edev under\nx-\u003elock and xfrm_state_dev_gc_lock, so only one caller unlinks the\nstate, invokes xdo_dev_state_free() and drops the netdevice reference.\nx-\u003elock also keeps xso-\u003edev stable for the stats updates that hold it.\n\nIn the flush, take a state reference before removing a state from the\ndevice GC list, so it stays alive while the flush owns it. Skip a\nstate with no reference left, the state GC frees it.\n\nKeep xso-\u003etype unchanged after detaching the device, so lockless\nreaders of xso-\u003etype do not see a packet offload state as a software\nstate. Reject offloaded states with no device in\nxfrm_dev_offload_ok(): a packet offload state would otherwise pass\nthe !dev check there, and xfrm_output() would send the packet with no\nESP or use the NULL device in xfrm_dev_direct_output().\n\nFound by the AI review of the commit above (see Link) and reproduced\non ConnectX-7 with a packet offload policy that has no SA, an acquire\nlistener that never reads, UDP senders hitting the policy and the\ndevice taken down in a loop:\n\n[  167.689163] Oops: general protection fault, probably for non-canonical address 0xdead000000000122: 0000 [#1] SMP\n[  167.690938] CPU: 11 UID: 0 PID: 2093 Comm: python3 Not tainted 7.4.0-rc1+ #10 PREEMPTLAZY\n[  167.694337] RIP: 0010:xfrm_dev_state_free+0x41/0xe0\n[  167.699068] RAX: dead000000000122 RBX: ff1100014f543800 RCX: ff11000103bbf800\n[  167.700247] RDX: dead000000000100 RSI: 0000000000000001 RDI: ffffffff82da8c68\n[  167.716897] Call Trace:\n[  167.717405]  \u003cTASK\u003e\n[  167.717863]  xfrm_state_find+0x19b0/0x1ab0\n[  167.718629]  xfrm_resolve_and_create_bundle+0x17d/0x11e0\n[  167.722070]  xfrm_lookup_with_ifid+0x1e7/0xb50\n[  167.722872]  xfrm_lookup_route+0x1d/0xa0\n[  167.723593]  udp_sendmsg+0x8da/0xc90\n[  167.724273]  __sock_sendmsg+0x38/0x70\n[  167.724988]  __sys_sendto+0x119/0x180\n[  167.727954]  __x64_sys_sendto+0x20/0x30\n[  167.728666]  do_syscall_64+0x72/0x3b0\n[  167.729357]  entry_SYSCALL_64_after_hwframe+0x4b/0x53\n[  167.741064]  \u003c/TASK\u003e\n[  167.752388] Kernel panic - not syncing: Fatal exception in interrupt\n\nWith this series the same test ran 400 cycles with no crash, and 150\ncycles on a kernel with KASAN and lockdep.\n\nFixes: 07b87f9eea0c (\"xfrm: Fix unregister netdevice hang on hardware offload.\")\nLink: https://lore.kernel.org/netdev/20260908224854.1591115-1-kuba@kernel.org/\nSigned-off-by: Jianbo Liu \u003cjianbol@nvidia.com\u003e\nReviewed-by: Carolina Jubran \u003ccjubran@nvidia.com\u003e\nSigned-off-by: Steffen Klassert \u003csteffen.klassert@secunet.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f153bf695b9dd19acbea3885de93ac2a8bf8d09e",
      "old_mode": 33188,
      "old_path": "net/xfrm/xfrm_device.c",
      "new_id": "3bbb970cd337f6ea663597f6f582325dcf98e94f",
      "new_mode": 33188,
      "new_path": "net/xfrm/xfrm_device.c"
    },
    {
      "type": "modify",
      "old_id": "9c101be250ee81d29b7e4925bb7abd53966b1323",
      "old_mode": 33188,
      "old_path": "net/xfrm/xfrm_state.c",
      "new_id": "6f98c5c1a823a333818296cca4939301ce1694e5",
      "new_mode": 33188,
      "new_path": "net/xfrm/xfrm_state.c"
    }
  ]
}
