From patchwork Fri Jan 25 18:49:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 2046961 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A83813FDC4 for ; Fri, 25 Jan 2013 18:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757443Ab3AYSuV (ORCPT ); Fri, 25 Jan 2013 13:50:21 -0500 Received: from h1446028.stratoserver.net ([85.214.92.142]:59139 "EHLO mail.ahsoftware.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756174Ab3AYSuQ (ORCPT ); Fri, 25 Jan 2013 13:50:16 -0500 Received: by mail.ahsoftware.de (Postfix, from userid 65534) id 5320C888B6A; Fri, 25 Jan 2013 19:50:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.ahsoftware.de X-Spam-Level: X-Spam-Status: No, score=-101.0 required=5.0 tests=ALL_TRUSTED, USER_IN_WHITELIST autolearn=disabled version=3.3.1 Received: from eiche.ahsoftware (p57B2045B.dip0.t-ipconnect.de [87.178.4.91]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTPSA id CD9C8888A75; Fri, 25 Jan 2013 19:50:14 +0100 (CET) Received: by eiche.ahsoftware (Postfix, from userid 65534) id 18CAC3FCB0; Fri, 25 Jan 2013 19:50:14 +0100 (CET) Received: from krabat.ahsoftware (unknown [192.168.207.2]) by eiche.ahsoftware (Postfix) with ESMTP id 1CE5C3FCB2; Fri, 25 Jan 2013 18:49:38 +0000 (UTC) From: Alexander Holler To: linux-kernel@vger.kernel.org Cc: linux-fbdev@vger.kernel.org, Florian Tobias Schandinat , Bernie Thompson , Steve Glendinning , Alexander Holler , Subject: [PATCH 3/3] fb: smscufx: fix hang at disconnect Date: Fri, 25 Jan 2013 19:49:28 +0100 Message-Id: <1359139768-32294-3-git-send-email-holler@ahsoftware.de> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1359139768-32294-1-git-send-email-holler@ahsoftware.de> References: <50F2A310.5010006@ahsoftware.de> <1359139768-32294-1-git-send-email-holler@ahsoftware.de> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org When a device was disconnected the driver may hang at waiting for urbs it never will get. Fix this by using a timeout while waiting for the used semaphore. There is still a memory leak if a timeout happens, but at least the driver now continues his disconnect routine. Cc: Signed-off-by: Alexander Holler --- drivers/video/smscufx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c index 97bd662..f26fa4f 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/smscufx.c @@ -1838,8 +1838,9 @@ static void ufx_free_urb_list(struct ufx_data *dev) /* keep waiting and freeing, until we've got 'em all */ while (count--) { - /* Getting interrupted means a leak, but ok at shutdown*/ - ret = down_interruptible(&dev->urbs.limit_sem); + /* Timeout likely occurs at disconnect (resulting in a leak) */ + ret = down_timeout_killable(&dev->urbs.limit_sem, + FREE_URB_TIMEOUT); if (ret) break;