From patchwork Thu Oct 10 12:58:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11183499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18A7D139A for ; Thu, 10 Oct 2019 12:58:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE71F21929 for ; Thu, 10 Oct 2019 12:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570712335; bh=JaOYT4xfOvr4kqwSZ9Wq5VVof1A2rGtzlZUoB310AmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iJC591qx+LnJgFnzu3Pqb5qalTBo2xUlMAOWeoNoINnDYUSyuvrL2vcWdKcbbLGDS 2yZs3q7P9poBSpP9RJOo2Tnoo5dRIkrZqBFu0xkpPVqs+bhJEnUwBB0Ci5wIBq+7/n PUhNt6azHsLzJ5uzfHUy0D2x5HV161VklQtpdB3U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388012AbfJJM6v (ORCPT ); Thu, 10 Oct 2019 08:58:51 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36597 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387794AbfJJM6v (ORCPT ); Thu, 10 Oct 2019 08:58:51 -0400 Received: by mail-lj1-f196.google.com with SMTP id v24so6121554ljj.3; Thu, 10 Oct 2019 05:58:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nsKcMQ0kOXYnZnGpbjDTlFoz3bxWZKfaGIfDlmHG+/g=; b=Z8MXgmuUU/nvrVbVfpy1YnDJd8c/qmkDd2x76wCLmUHyEpVlDxSQMNgf0y1IS0laId sMDAfGv2s0P/dJsMekm/OKElcleDdHR7F6uT2h2caDntPa8fHL8ZK1CBn9hRgOZuMHt2 hdKXhACVZkQvhphCNZXN3w3a6FRpHadKGR9fLUodIhnqPSBVHL6dIrH+/swzEfaSgrJ6 JmAhEqITITwvKMM5gzYGWkRPtIVVM/IV9v4l4bNUXPF9n3/Wklqu0Dikapv/BDDSGhuZ dRBlldm0PqJxb3wWJOnoFFbkm8oiT71QA6WLj6WS8qWVqfIK6mTewuPKNnhRbBGCUA91 9wGw== X-Gm-Message-State: APjAAAWxbm9NQ0X5kCmVRmTY5BdnmtTjpvhnBuQEJLwuxKQKyZjO3crp sdetcBkk5oMnghMRcwg2oRE= X-Google-Smtp-Source: APXvYqyYwfJIZO43Ub4WJDb8ROAYklkPlkhFFphSgKBa72PXTj14GSlJ1q9kJnVRvgIDOOWK8RPvJQ== X-Received: by 2002:a2e:8204:: with SMTP id w4mr6369540ljg.212.1570712328399; Thu, 10 Oct 2019 05:58:48 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id l3sm1247120lfc.31.2019.10.10.05.58.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 05:58:46 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iIY1x-00072w-Km; Thu, 10 Oct 2019 14:58:57 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Juergen Stuber , Johan Hovold , stable Subject: [PATCH 2/2] USB: legousbtower: fix memleak on disconnect Date: Thu, 10 Oct 2019 14:58:35 +0200 Message-Id: <20191010125835.27031-3-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010125835.27031-1-johan@kernel.org> References: <20191010125835.27031-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If disconnect() races with release() after a process has been interrupted, release() could end up returning early and the driver would fail to free its driver data. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 9d4c52a7ebe0..62dab2441ec4 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -419,10 +419,7 @@ static int tower_release (struct inode *inode, struct file *file) goto exit; } - if (mutex_lock_interruptible(&dev->lock)) { - retval = -ERESTARTSYS; - goto exit; - } + mutex_lock(&dev->lock); if (dev->open_count != 1) { dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n",