From patchwork Thu Oct 10 12:58:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11183503 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 E01611575 for ; Thu, 10 Oct 2019 12:58:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0E0C21929 for ; Thu, 10 Oct 2019 12:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570712339; bh=1dj2wrbcSptv7rwRFOSmaeJnL3cw9XYOzs3YE9J3SXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rCVr0E9MMRCEIRcNjafp/iEkgz0oYLPn9FSFEHNxeO3JbhLHIagLbLnuMCeSernAs +mvA3fqoUCKaIi7dvOdK9fTJL/2itGyMQjpZWNVTNCDn4RxzlA5++aa/Eh8HmV9Y6/ Kf1fc2WK+OrX2u58k+40K2UNUJKdsec3gzzAWc0M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388026AbfJJM65 (ORCPT ); Thu, 10 Oct 2019 08:58:57 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43445 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfJJM6u (ORCPT ); Thu, 10 Oct 2019 08:58:50 -0400 Received: by mail-lj1-f196.google.com with SMTP id n14so6072783ljj.10; Thu, 10 Oct 2019 05:58:48 -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=sFfJKZrsZ65QHdG/a6Vjdwobjv+Fk7Z1ecZ7AQainIo=; b=PFBusBVRzgPljPc+cHreTsNfSAxkcbWsYhHyRB0TI9kSHuNA+J9TFgSkZvPBF7bEhq AxdKaIfzITQXUCRgNV5BcUynpqGJsdcDA6VqmlfjcSSMbCw/QvO2KtGu8tKpvAB8nkxu 00BMrsAUw2jOA/fAmS023KaVFGTVjj31UtjciWx4l5quuEeTylhTY+J1O7j/0gRnw6e7 qT+zb6UYnMjoYA7Z1ZBBq6vZOjn76pgtqe9jAUcQNZcBYMR5R288HJcI0u9RPgXvLoP9 iEIYCJtQ10HGosng4lOrQnzpwUTNsfggg6tRCL09mmz+vFQayTGws8QxC2gf5U64tRFA urSw== X-Gm-Message-State: APjAAAX161qTIt014B/mIdHiMTnW3FEOrpDcGS/oUjjuKYnkXt3OpA1d SuVk9KxvlB9ejMzhh+FGqzs= X-Google-Smtp-Source: APXvYqzrMxpqqH/x0hvuWkRUifQkU26w8tdkyxPlpaMcnr1jxd8rdd6qQGWg12N0vXP4j9dc3lkBXQ== X-Received: by 2002:a2e:9a43:: with SMTP id k3mr6000549ljj.70.1570712327840; Thu, 10 Oct 2019 05:58:47 -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 c26sm1358291ljj.45.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-00072r-HT; 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 1/2] USB: ldusb: fix memleak on disconnect Date: Thu, 10 Oct 2019 14:58:34 +0200 Message-Id: <20191010125835.27031-2-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: 2824bd250f0b ("[PATCH] USB: add ldusb driver") Cc: stable # 2.6.13 Signed-off-by: Johan Hovold --- drivers/usb/misc/ldusb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index f3108d85e768..147c90c2a4e5 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -380,10 +380,7 @@ static int ld_usb_release(struct inode *inode, struct file *file) goto exit; } - if (mutex_lock_interruptible(&dev->mutex)) { - retval = -ERESTARTSYS; - goto exit; - } + mutex_lock(&dev->mutex); if (dev->open_count != 1) { retval = -ENODEV; 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",