)]}'
{
  "commit": "083aaafd453c3fb14411519d6ada9a8917573fdb",
  "tree": "6b3e12e495d76c7a29c246d840b141c86643d2e2",
  "parents": [
    "1e860f42f41c6fbf3304f6a52be38245b9394982"
  ],
  "author": {
    "name": "Sicong Huang",
    "email": "congei42@163.com",
    "time": "Sat Oct 24 12:49:03 2026 +0800"
  },
  "committer": {
    "name": "Dave Miller",
    "email": "davem@davem-thinkpadp1gen8.ibmlond.csb",
    "time": "Wed Oct 28 10:09:46 2026 +0000"
  },
  "message": "nfp: flower: fix use-after-free in neighbour update work\n\nThe netevent notifier handles neighbour updates and redirects by\nqueuing nfp_tun_neigh_update() on system_highpri_wq. Each work item\nholds a reference to the neighbour, but only stores a pointer to the\nflower app.\n\nDuring device removal, nfp_tunnel_config_stop() unregisters the\nnotifier. This waits for notifier callbacks to return, but does not\nwait for the work they queued. The teardown then frees app-\u003epriv and\napp without waiting for these work items. Flushing cmsg_work in\nnfp_flower_clean() does not cover the neighbour update work.\n\nA pending work item can therefore run after the app has been freed.\nIts call to nfp_flower_get_port_id_from_netdev() can then access freed\nmemory while checking whether the neighbour\u0027s device can be offloaded.\nEven notifications for unrelated devices can reach this check. The\nsame problem affects shutdown and probe error paths that tear down the\napp after the netevent notifier has been registered.\n\nOne possible interleaving is shown below. The neighbour belongs to\nanother network device that remains registered.\n\n  CPU0 (remove)                   CPU1 (notifier / kworker)\n                                  nfp_tun_neigh_event_handler()\n                                    queue_work(system_highpri_wq, ...)\n                                    return\n                                  /* Work has not run yet. */\n  nfp_tunnel_config_stop()\n    unregister_netevent_notifier()\n    /* Notifier callbacks have finished, but work may be pending. */\n  nfp_flower_clean()\n    vfree(app-\u003epriv)\n    app-\u003epriv \u003d NULL\n  nfp_app_free()\n    kfree(app)\n                                  nfp_tun_neigh_update()\n                                    app \u003d update_work-\u003eapp\n                                    nfp_flower_get_port_id_from_netdev()\n                                      app-\u003epriv  /* use-after-free */\n\nThe work items are allocated per event and free themselves, so they\ncannot be cancelled individually, and flushing system_highpri_wq is\nnot allowed. Use a dedicated workqueue for neighbour updates instead.\nIn nfp_tunnel_config_stop(), unregister the notifier and destroy the\nworkqueue before cleaning up the tunnel state. This prevents new work\nfrom being queued and waits for pending and running work to finish\nwhile the app and its resources are still valid.\n\nFound by code inspection.\n\nFixes: 0ad722bd9ee3 (\"nfp: flower: fix for take a mutex lock in soft irq context and rcu lock\")\nSigned-off-by: Sicong Huang \u003ccongei42@163.com\u003e\nReviewed-by: Daniel Machon \u003cdaniel.machon@microchip.com\u003e\nSigned-off-by: Dave Miller \u003cdavem@davem-thinkpadp1gen8.ibmlond.csb\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2b7c947ff4f2ab3402199edebe329b1a6a189d86",
      "old_mode": 33188,
      "old_path": "drivers/net/ethernet/netronome/nfp/flower/main.h",
      "new_id": "bd4399758ed4d099ac7d9a5081012b6e18ff182f",
      "new_mode": 33188,
      "new_path": "drivers/net/ethernet/netronome/nfp/flower/main.h"
    },
    {
      "type": "modify",
      "old_id": "3b47e9fe64e17039363069f73b92e1b6f17a56e0",
      "old_mode": 33188,
      "old_path": "drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c",
      "new_id": "46b6cda7f3d3b2c532dc5d5fe2d70a85d51e2f95",
      "new_mode": 33188,
      "new_path": "drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c"
    }
  ]
}
