From patchwork Sat Jan 12 13:20:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 1969041 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C3C5ADF230 for ; Sat, 12 Jan 2013 13:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753265Ab3ALNUz (ORCPT ); Sat, 12 Jan 2013 08:20:55 -0500 Received: from h1446028.stratoserver.net ([85.214.92.142]:45245 "EHLO mail.ahsoftware.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753210Ab3ALNUy (ORCPT ); Sat, 12 Jan 2013 08:20:54 -0500 Received: by mail.ahsoftware.de (Postfix, from userid 65534) id BFB9B888AF7; Sat, 12 Jan 2013 14:20:52 +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 (p57B20AF6.dip0.t-ipconnect.de [87.178.10.246]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTPSA id 4AE7D8880F8; Sat, 12 Jan 2013 14:20:52 +0100 (CET) Received: by eiche.ahsoftware (Postfix, from userid 65534) id 520053FCA5; Sat, 12 Jan 2013 14:20:51 +0100 (CET) Received: from krabat.ahsoftware (unknown [192.168.207.2]) by eiche.ahsoftware (Postfix) with ESMTP id 162A73FC83; Sat, 12 Jan 2013 13:20:41 +0000 (UTC) From: Alexander Holler To: linux-kernel@vger.kernel.org Cc: linux-fbdev@vger.kernel.org, Bernie Thompson , Florian Tobias Schandinat , Alan Cox , Steve Glendinning , Dave Airlie , Alexander Holler , Subject: [PATCH] fb: udlfb: fix hang at disconnect Date: Sat, 12 Jan 2013 14:20:22 +0100 Message-Id: <1357996822-13072-1-git-send-email-holler@ahsoftware.de> X-Mailer: git-send-email 1.7.11.7 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/udlfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 86d449e..cc4a8d1 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -1832,8 +1832,8 @@ static void dlfb_free_urb_list(struct dlfb_data *dev) /* keep waiting and freeing, until we've got 'em all */ while (count--) { - /* Getting interrupted means a leak, but ok at disconnect */ - ret = down_interruptible(&dev->urbs.limit_sem); + /* Timeout likely occurs at disconnect (resulting in a leak) */ + ret = down_timeout(&dev->urbs.limit_sem, GET_URB_TIMEOUT); if (ret) break;