Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp29259ybj; Fri, 8 May 2020 05:53:53 -0700 (PDT) X-Google-Smtp-Source: APiQypIk6ueOKfsX+VdKM5seQLU8rLtdUCNFZfebcUnk6FZFVAdcWLsJh0PRTS2cxxTOvWTGLIpi X-Received: by 2002:a17:906:4cc3:: with SMTP id q3mr1783199ejt.170.1588942433064; Fri, 08 May 2020 05:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588942433; cv=none; d=google.com; s=arc-20160816; b=viAuSxHlkLQreLirndZQNOMMt23fp0QZ8p6KLEtR/sM/R/Dl+Qri11Sn7+2HO//BJf Kgfrp59M+SGP+acF8I+yk7rb+1k1tK7dQtny6+wleQgvr8EGWIek3zzOWzNK2os7U+Yn uoaTA6DnG/Q3ZiELQYZVPyXHvQID+3ldh/GobdSMKlTrP+6ZZmIempoWdKIdXEaE2Wzm Ylr8/Ttu8+KoWo8c5z+JL/A8a1NrUServvo5WTXpM0ThHk5RvaYgoQEBNvQoEfH71/4Q BHnU1PmNvrHG2G8uh+hOldM5mncv9tHSS3rJek/OfVZzGZt3wP/hD5crd7ZpKLUU34qm amXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HtTH4j/xuHm6pjCCz+BLvs7BXHETMlNYJyyElw8N2c8=; b=yoyViFvf0iaaqrPRnS6kYwlTz8BUhbZTOx64+EYs13qbudhaNagGBlxVu/paO3Rqby TvdJ0QjYihDkbeJF7bX98m/XyBkPVTYyCXXdg7BagZTvOY/7oXj6DC8FW3pVznZq34my hlGUU4hWNI3Cm9PYMAGL8FY/4SvebcVDZVraytbG7mSkdVx3bINNodIfXBB5a5TA0GVT b9zEC4z7wb+fDSK06QJxqysL25oDj3OaPkNnpXqhw4ubMV/V+akMnRMnME8J06uYxQMF 7ul4deZXgvcArZPpnzeFVWaqucwAQPCib+roYNzmpx8iBH2SczfbumNhcCp+Uz5102i5 895g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cecYAiN9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si896001ejb.294.2020.05.08.05.53.28; Fri, 08 May 2020 05:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cecYAiN9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729799AbgEHMt6 (ORCPT + 99 others); Fri, 8 May 2020 08:49:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:56538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728384AbgEHMt4 (ORCPT ); Fri, 8 May 2020 08:49:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 40E1624959; Fri, 8 May 2020 12:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942195; bh=npQORT7k6BMBnV/iE7pXMc6qEQG52l4MhZvVTTh3GjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cecYAiN9nZl4ItmTzsb7rt21lKJh7zZYaaZd5CxSJxC4hEBw/xzF+1sEM4EmFenH3 0h4nHe6vlv+AOyR0IsafFffLZUguRhOrZqv7/JcTgT+BI9Xu0JwyxKsj6XjxBH8SMp H4SIyQxKBJ4f2MqyXuws47vGYjF58C3hUrhuhpGI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiyu Yang , Xin Tan , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 06/18] wimax/i2400m: Fix potential urb refcnt leak Date: Fri, 8 May 2020 14:35:09 +0200 Message-Id: <20200508123032.466947258@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123030.497793118@linuxfoundation.org> References: <20200508123030.497793118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiyu Yang [ Upstream commit 7717cbec172c3554d470023b4020d5781961187e ] i2400mu_bus_bm_wait_for_ack() invokes usb_get_urb(), which increases the refcount of the "notif_urb". When i2400mu_bus_bm_wait_for_ack() returns, local variable "notif_urb" becomes invalid, so the refcount should be decreased to keep refcount balanced. The issue happens in all paths of i2400mu_bus_bm_wait_for_ack(), which forget to decrease the refcnt increased by usb_get_urb(), causing a refcnt leak. Fix this issue by calling usb_put_urb() before the i2400mu_bus_bm_wait_for_ack() returns. Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wimax/i2400m/usb-fw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c index e74664b84925e..4e4167976acf6 100644 --- a/drivers/net/wimax/i2400m/usb-fw.c +++ b/drivers/net/wimax/i2400m/usb-fw.c @@ -354,6 +354,7 @@ ssize_t i2400mu_bus_bm_wait_for_ack(struct i2400m *i2400m, usb_autopm_put_interface(i2400mu->usb_iface); d_fnend(8, dev, "(i2400m %p ack %p size %zu) = %ld\n", i2400m, ack, ack_size, (long) result); + usb_put_urb(¬if_urb); return result; error_exceeded: -- 2.20.1