summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorWei Wang <weiwan@google.com>2017-06-16 20:46:37 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-05 15:37:14 +0300
commitf50f2e0cb1a3733e8846d8d3a0bee3ab24378874 (patch)
treedaee3bca8dab04b331f71ac9d9cb95e3d77ba5fd /firmware
parent93911697a9f205f1e8f84c4760b754d4d04459da (diff)
downloadlinux-f50f2e0cb1a3733e8846d8d3a0bee3ab24378874.tar.xz
decnet: always not take dst->__refcnt when inserting dst into hash table
[ Upstream commit 76371d2e3ad1f84426a30ebcd8c3b9b98f4c724f ] In the existing dn_route.c code, dn_route_output_slow() takes dst->__refcnt before calling dn_insert_route() while dn_route_input_slow() does not take dst->__refcnt before calling dn_insert_route(). This makes the whole routing code very buggy. In dn_dst_check_expire(), dnrt_free() is called when rt expires. This makes the routes inserted by dn_route_output_slow() not able to be freed as the refcnt is not released. In dn_dst_gc(), dnrt_drop() is called to release rt which could potentially cause the dst->__refcnt to be dropped to -1. In dn_run_flush(), dst_free() is called to release all the dst. Again, it makes the dst inserted by dn_route_output_slow() not able to be released and also, it does not wait on the rcu and could potentially cause crash in the path where other users still refer to this dst. This patch makes sure both input and output path do not take dst->__refcnt before calling dn_insert_route() and also makes sure dnrt_free()/dst_free() is called when removing dst from the hash table. The only difference between those 2 calls is that dnrt_free() waits on the rcu while dst_free() does not. Signed-off-by: Wei Wang <weiwan@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'firmware')
0 files changed, 0 insertions, 0 deletions