From patchwork Fri Jul 13 20:07:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 10524083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F4886032C for ; Fri, 13 Jul 2018 20:09:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EFF129E7D for ; Fri, 13 Jul 2018 20:09:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 232DE29E95; Fri, 13 Jul 2018 20:09:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0000229E7D for ; Fri, 13 Jul 2018 20:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731542AbeGMUZj (ORCPT ); Fri, 13 Jul 2018 16:25:39 -0400 Received: from mail.ispras.ru ([83.149.199.45]:49490 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731342AbeGMUZj (ORCPT ); Fri, 13 Jul 2018 16:25:39 -0400 Received: from localhost.localdomain (ppp85-140-182-44.pppoe.mtu-net.ru [85.140.182.44]) by mail.ispras.ru (Postfix) with ESMTPSA id 53B83540094; Fri, 13 Jul 2018 23:09:30 +0300 (MSK) From: Alexey Khoroshilov To: Dmitry Torokhov , Marcus Folkesson Cc: Alexey Khoroshilov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] Input: pxrc - fix leak of usb_device Date: Fri, 13 Jul 2018 23:07:57 +0300 Message-Id: <1531512477-31981-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pxrc_probe() calls usb_get_dev(), but there is no usb_put_dev() anywhere in the driver. The patch adds one to error handling code and to pxrc_disconnect(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Reviewed-by: Marcus Folkesson --- drivers/input/joystick/pxrc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c index 07a0dbd3ced2..0a31de63ac8e 100644 --- a/drivers/input/joystick/pxrc.c +++ b/drivers/input/joystick/pxrc.c @@ -221,6 +221,7 @@ static int pxrc_probe(struct usb_interface *intf, usb_free_urb(pxrc->urb); error: + usb_put_dev(pxrc->udev); return retval; } @@ -229,6 +230,7 @@ static void pxrc_disconnect(struct usb_interface *intf) struct pxrc *pxrc = usb_get_intfdata(intf); usb_free_urb(pxrc->urb); + usb_put_dev(pxrc->udev); usb_set_intfdata(intf, NULL); }