Skip to content
  1. Feb 21, 2019
    • Cong Wang's avatar
      net_sched: fix a memory leak in cls_tcindex · 51dcb69d
      Cong Wang authored
      (cherry picked from commit 033b228e
      
      )
      
      When tcindex_destroy() destroys all the filter results in
      the perfect hash table, it invokes the walker to delete
      each of them. However, results with class==0 are skipped
      in either tcindex_walk() or tcindex_delete(), which causes
      a memory leak reported by kmemleak.
      
      This patch fixes it by skipping the walker and directly
      deleting these filter results so we don't miss any filter
      result.
      
      As a result of this change, we have to initialize exts->net
      properly in tcindex_alloc_perfect_hash(). For net-next, we
      need to consider whether we should initialize ->net in
      tcf_exts_init() instead, before that just directly test
      CONFIG_NET_CLS_ACT=y.
      
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      51dcb69d
    • Cong Wang's avatar
      net_sched: fix a race condition in tcindex_destroy() · 3d210534
      Cong Wang authored
      (cherry picked from commit 8015d93e)
      
      tcindex_destroy() invokes tcindex_destroy_element() via
      a walker to delete each filter result in its perfect hash
      table, and tcindex_destroy_element() calls tcindex_delete()
      which schedules tcf RCU works to do the final deletion work.
      Unfortunately this races with the RCU callback
      __tcindex_destroy(), which could lead to use-after-free as
      reported by Adrian.
      
      Fix this by migrating this RCU callback to tcf RCU work too,
      as that workqueue is ordered, we will not have use-after-free.
      
      Note, we don't need to hold netns refcnt because we don't call
      tcf_exts_destroy() here.
      
      Fixes: 27ce4f05
      
       ("net_sched: use tcf_queue_work() in tcindex filter")
      Reported-by: default avatarAdrian <bugs@abtelecom.ro>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d210534
    • Willem de Bruijn's avatar
      gso: validate gso_type on ipip style tunnels · 418e897e
      Willem de Bruijn authored
      Commit 121d57af
      
       ("gso: validate gso_type in GSO handlers") added
      gso_type validation to existing gso_segment callback functions, to
      filter out illegal and potentially dangerous SKB_GSO_DODGY packets.
      
      Convert tunnels that now call inet_gso_segment and ipv6_gso_segment
      directly to have their own callbacks and extend validation to these.
      
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      418e897e
    • Vakul Garg's avatar
      selftest/tls: Add test to verify received 'type' of non-data record · 203ef5f1
      Vakul Garg authored
      
      
      Test case 'control_msg' has been updated to peek non-data record and
      then verify the type of record received. Subsequently, the same record
      is retrieved without MSG_PEEK flag in recvmsg().
      
      Signed-off-by: default avatarVakul Garg <vakul.garg@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      203ef5f1
  2. Feb 20, 2019
  3. Feb 19, 2019