)]}'
{
  "commit": "72f17baf2352ded6a1d3f4bb2d15da8c678cd2cb",
  "tree": "f0f6363eb181e80c333173a80a74d1c4540bc766",
  "parents": [
    "23b8392201e0681b76630c4cea68e1a2e1821ec6"
  ],
  "author": {
    "name": "Stefano Brivio",
    "email": "sbrivio@redhat.com",
    "time": "Thu May 03 18:13:25 2018 +0200"
  },
  "committer": {
    "name": "David S. Miller",
    "email": "davem@davemloft.net",
    "time": "Fri May 04 12:51:02 2018 -0400"
  },
  "message": "openvswitch: Don\u0027t swap table in nlattr_set() after OVS_ATTR_NESTED is found\n\nIf an OVS_ATTR_NESTED attribute type is found while walking\nthrough netlink attributes, we call nlattr_set() recursively\npassing the length table for the following nested attributes, if\ndifferent from the current one.\n\nHowever, once we\u0027re done with those sub-nested attributes, we\nshould continue walking through attributes using the current\ntable, instead of using the one related to the sub-nested\nattributes.\n\nFor example, given this sequence:\n\n1  OVS_KEY_ATTR_PRIORITY\n2  OVS_KEY_ATTR_TUNNEL\n3\tOVS_TUNNEL_KEY_ATTR_ID\n4\tOVS_TUNNEL_KEY_ATTR_IPV4_SRC\n5\tOVS_TUNNEL_KEY_ATTR_IPV4_DST\n6\tOVS_TUNNEL_KEY_ATTR_TTL\n7\tOVS_TUNNEL_KEY_ATTR_TP_SRC\n8\tOVS_TUNNEL_KEY_ATTR_TP_DST\n9  OVS_KEY_ATTR_IN_PORT\n10 OVS_KEY_ATTR_SKB_MARK\n11 OVS_KEY_ATTR_MPLS\n\nwe switch to the \u0027ovs_tunnel_key_lens\u0027 table on attribute #3,\nand we don\u0027t switch back to \u0027ovs_key_lens\u0027 while setting\nattributes #9 to #11 in the sequence. As OVS_KEY_ATTR_MPLS\nevaluates to 21, and the array size of \u0027ovs_tunnel_key_lens\u0027 is\n15, we also get this kind of KASan splat while accessing the\nwrong table:\n\n[ 7654.586496] \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[ 7654.594573] BUG: KASAN: global-out-of-bounds in nlattr_set+0x164/0xde9 [openvswitch]\n[ 7654.603214] Read of size 4 at addr ffffffffc169ecf0 by task handler29/87430\n[ 7654.610983]\n[ 7654.612644] CPU: 21 PID: 87430 Comm: handler29 Kdump: loaded Not tainted 3.10.0-866.el7.test.x86_64 #1\n[ 7654.623030] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.1.7 06/16/2016\n[ 7654.631379] Call Trace:\n[ 7654.634108]  [\u003cffffffffb65a7c50\u003e] dump_stack+0x19/0x1b\n[ 7654.639843]  [\u003cffffffffb53ff373\u003e] print_address_description+0x33/0x290\n[ 7654.647129]  [\u003cffffffffc169b37b\u003e] ? nlattr_set+0x164/0xde9 [openvswitch]\n[ 7654.654607]  [\u003cffffffffb53ff812\u003e] kasan_report.part.3+0x242/0x330\n[ 7654.661406]  [\u003cffffffffb53ff9b4\u003e] __asan_report_load4_noabort+0x34/0x40\n[ 7654.668789]  [\u003cffffffffc169b37b\u003e] nlattr_set+0x164/0xde9 [openvswitch]\n[ 7654.676076]  [\u003cffffffffc167ef68\u003e] ovs_nla_get_match+0x10c8/0x1900 [openvswitch]\n[ 7654.684234]  [\u003cffffffffb61e9cc8\u003e] ? genl_rcv+0x28/0x40\n[ 7654.689968]  [\u003cffffffffb61e7733\u003e] ? netlink_unicast+0x3f3/0x590\n[ 7654.696574]  [\u003cffffffffc167dea0\u003e] ? ovs_nla_put_tunnel_info+0xb0/0xb0 [openvswitch]\n[ 7654.705122]  [\u003cffffffffb4f41b50\u003e] ? unwind_get_return_address+0xb0/0xb0\n[ 7654.712503]  [\u003cffffffffb65d9355\u003e] ? system_call_fastpath+0x1c/0x21\n[ 7654.719401]  [\u003cffffffffb4f41d79\u003e] ? update_stack_state+0x229/0x370\n[ 7654.726298]  [\u003cffffffffb4f41d79\u003e] ? update_stack_state+0x229/0x370\n[ 7654.733195]  [\u003cffffffffb53fe4b5\u003e] ? kasan_unpoison_shadow+0x35/0x50\n[ 7654.740187]  [\u003cffffffffb53fe62a\u003e] ? kasan_kmalloc+0xaa/0xe0\n[ 7654.746406]  [\u003cffffffffb53fec32\u003e] ? kasan_slab_alloc+0x12/0x20\n[ 7654.752914]  [\u003cffffffffb53fe711\u003e] ? memset+0x31/0x40\n[ 7654.758456]  [\u003cffffffffc165bf92\u003e] ovs_flow_cmd_new+0x2b2/0xf00 [openvswitch]\n\n[snip]\n\n[ 7655.132484] The buggy address belongs to the variable:\n[ 7655.138226]  ovs_tunnel_key_lens+0xf0/0xffffffffffffd400 [openvswitch]\n[ 7655.145507]\n[ 7655.147166] Memory state around the buggy address:\n[ 7655.152514]  ffffffffc169eb80: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa\n[ 7655.160585]  ffffffffc169ec00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n[ 7655.168644] \u003effffffffc169ec80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa\n[ 7655.176701]                                                              ^\n[ 7655.184372]  ffffffffc169ed00: fa fa fa fa 00 00 00 00 fa fa fa fa 00 00 00 05\n[ 7655.192431]  ffffffffc169ed80: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00\n[ 7655.200490] \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\nReported-by: Hangbin Liu \u003cliuhangbin@gmail.com\u003e\nFixes: 982b52700482 (\"openvswitch: Fix mask generation for nested attributes.\")\nSigned-off-by: Stefano Brivio \u003csbrivio@redhat.com\u003e\nReviewed-by: Sabrina Dubroca \u003csd@queasysnail.net\u003e\nSigned-off-by: David S. Miller \u003cdavem@davemloft.net\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7322aa1e382e4ba476243ef47801a50df2efb7f1",
      "old_mode": 33188,
      "old_path": "net/openvswitch/flow_netlink.c",
      "new_id": "492ab0c36f7c9e3caf6de7e7d77368028716e09c",
      "new_mode": 33188,
      "new_path": "net/openvswitch/flow_netlink.c"
    }
  ]
}
