From patchwork Wed Apr 30 09:39:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 344077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9C8451400AC for ; Wed, 30 Apr 2014 19:40:36 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=VPh8bxRB3741cz5E jSKGyBwI4AU3iG527HPl/qxmXeEh8/xBx+PlAxSGbrG7Xt8iulMoA4EWye+/SFm6 kKL55m/DJeLp04Y/Hu7KSgWWEXLyAi4cYczuAc39Nk2QqgJVHZzrIi6dG6hxvOUb RzOw/DCJJr6Vj8LngHkbFL77pzQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; s=default; bh=lBcoZRLAuYeQFgJeVltfG4 8rRAU=; b=nXHkpjQNykIfxZDPMJOwQpoCc1Rvg2xlNbqrH5F6QB0Rt8NZILz7sN SnVrWSM6szcrL/ZQbDN2viMBZ5MlggFw6J8voxuNq8XIQW05KdFjsMHSOaEAH7uw MTqdpA/7uToJ/8nu00AUAjiSRiY49rGinA1PxmmPbrJOEGe+0fFhE= Received: (qmail 5112 invoked by alias); 30 Apr 2014 09:40:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5091 invoked by uid 89); 30 Apr 2014 09:40:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: szxga02-in.huawei.com From: Yang Yingliang To: CC: , Subject: [PATCH] Fix lll_unlock twice in pthread_cond_broadcast Date: Wed, 30 Apr 2014 17:39:58 +0800 Message-ID: <1398850798-5648-1-git-send-email-yangyingliang@huawei.com> MIME-Version: 1.0 X-CFilter-Loop: Reflected lll_unlock() will be called again if it goes to "wake_all" in pthread_cond_broadcast(). This may make another thread which is waiting for lock in pthread_cond_timedwait() unlock. So there are more than one threads get the lock, it will break the shared data. It's introduced by commit 8313cb997d2d("FUTEX_*_REQUEUE_PI support for non-x86 code") --- nptl/pthread_cond_broadcast.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c index ed30e7c60bc7..7c6c9ea9a2d5 100644 --- a/nptl/pthread_cond_broadcast.c +++ b/nptl/pthread_cond_broadcast.c @@ -81,6 +81,7 @@ __pthread_cond_broadcast (cond) wake_all: lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared); + return 0; } /* We are done. */