From: Arnaldo Carvalho de Melo Date: Tue, 21 Mar 2006 05:28:11 +0000 (-0800) Subject: [LLC]: Fix sap refcounting X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2e1f47c74c26a591fc490eb339f1b3167361158b;p=openwrt%2Fstaging%2Fblogic.git [LLC]: Fix sap refcounting Thanks to Leslie Harlley Watter for reporting the problem an testing this patch. Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 233794435bb8..5a04db745c8d 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c @@ -187,8 +187,10 @@ static int llc_ui_release(struct socket *sock) llc->laddr.lsap, llc->daddr.lsap); if (!llc_send_disc(sk)) llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo); - if (!sock_flag(sk, SOCK_ZAPPED)) + if (!sock_flag(sk, SOCK_ZAPPED)) { + llc_sap_put(llc->sap); llc_sap_remove_socket(llc->sap, sk); + } release_sock(sk); if (llc->dev) dev_put(llc->dev); diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c index ab0fcd32fd84..bd242a49514a 100644 --- a/net/llc/llc_core.c +++ b/net/llc/llc_core.c @@ -127,7 +127,6 @@ struct llc_sap *llc_sap_open(unsigned char lsap, goto out; sap->laddr.lsap = lsap; sap->rcv_func = func; - llc_sap_hold(sap); llc_add_sap(sap); out: write_unlock_bh(&llc_sap_list_lock);