소스 검색

[CCID]: Make ccid_hc_[rt]x_exit accept NULL arguments

Just like kfree, etc it will just not call the CCID exit
routines when the private data area is set to NULL.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Arnaldo Carvalho de Melo 19 년 전
부모
커밋
012e13eac7
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      net/dccp/ccid.h

+ 4 - 2
net/dccp/ccid.h

@@ -97,13 +97,15 @@ static inline int ccid_hc_tx_init(struct ccid *ccid, struct sock *sk)
 
 static inline void ccid_hc_rx_exit(struct ccid *ccid, struct sock *sk)
 {
-	if (ccid->ccid_hc_rx_exit != NULL)
+	if (ccid->ccid_hc_rx_exit != NULL &&
+	    dccp_sk(sk)->dccps_hc_rx_ccid_private != NULL)
 		ccid->ccid_hc_rx_exit(sk);
 }
 
 static inline void ccid_hc_tx_exit(struct ccid *ccid, struct sock *sk)
 {
-	if (ccid->ccid_hc_tx_exit != NULL)
+	if (ccid->ccid_hc_tx_exit != NULL &&
+	    dccp_sk(sk)->dccps_hc_tx_ccid_private != NULL)
 		ccid->ccid_hc_tx_exit(sk);
 }