From patchwork Tue Jun 25 12:42:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Li X-Patchwork-Id: 1122038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=139.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Y5dq0Kk1z9s7h for ; Tue, 25 Jun 2019 22:51:58 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E363CEF0; Tue, 25 Jun 2019 12:51:55 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9902DEEF for ; Tue, 25 Jun 2019 12:51:53 +0000 (UTC) X-Greylist: delayed 00:09:16 by SQLgrey-1.7.6 Received: from n9-32.mail.139.com (n9-32.mail.139.com [221.176.9.32]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 21D4D82C for ; Tue, 25 Jun 2019 12:51:49 +0000 (UTC) X-RM-TagInfo: emlType=0 X-RM-SPAM: X-RM-SPAM-FLAG: 00000000 Received: from B000000115533A.internal.baidu.com (unknown[61.135.169.81]) by rmsmtp-rmapp-13-12031 (RichMail) with SMTP id 2eff5d1216a8b77-d3f58; Tue, 25 Jun 2019 20:42:18 +0800 (CST) X-RM-TRANSID: 2eff5d1216a8b77-d3f58 From: Wang Li To: ovs-dev@openvswitch.org Date: Tue, 25 Jun 2019 20:42:14 +0800 Message-Id: <20190625124214.55989-1-wang.li@139.com> X-Mailer: git-send-email 2.15.2 (Apple Git-101.1) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovs-rcu: Fix potential double free issue X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Wang Li If pthread_setspecific set value of the key to NULL, then it will trigger the destructor function ovsrcu_thread_exit_cb to call ovsrcu_unregister__ implicitly, so we have to remove it here to avoid potential double free issue. Signed-off-by: Wang Li --- lib/ovs-rcu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c index ebc8120f0..3adfe5c3f 100644 --- a/lib/ovs-rcu.c +++ b/lib/ovs-rcu.c @@ -134,7 +134,6 @@ ovsrcu_quiesce_start(void) perthread = pthread_getspecific(perthread_key); if (perthread) { pthread_setspecific(perthread_key, NULL); - ovsrcu_unregister__(perthread); } ovsrcu_quiesced();