Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2252145ybg; Sun, 27 Oct 2019 14:25:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzltAX/C+vlGvD0dbglds6tjdMUTgtIIzgtQExgjsxdxSn/MNtkvSfh7eE7o5fqidqdpq/r X-Received: by 2002:a17:906:5407:: with SMTP id q7mr13918667ejo.24.1572211538042; Sun, 27 Oct 2019 14:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572211538; cv=none; d=google.com; s=arc-20160816; b=eZVXi3LtAf+672mCzGH00TYnV2L7I9Q2Q/L0VHNjktME8sXtyUN7sTyk8VK1aP3heC PVruVy8Dlb4XteEybjoIW5CSdsyxQsi46v/j+IEtn0J/5Lqf9H9gMz9ByDqyxP5mS0j/ sTt2dFdn+EAoZjrdPaegfSR0sPZ3QBZUsupX7rDCf6RzrY62OQVeroXcP5DSPvFzNH3L 2WadjIMnND/ILfSLPGnb2aqk9p9sPbySoXta4TUyQ+cPUkcXLdr29ZrcZglSwlpJq8O5 bXbnR4CccMfxS8WAqUxDvCiqYa1UNvVqcVkljVfisHPiLy9G0q0I7sj//cPTT3bh7+gU nhPw== 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=oDwQIoVP7KBEIvhSHREBW4XFaCoKYtrVkaNu+gXsp7U=; b=Jt6YzTT5+2IRDy3OmhSPPJURPyGOkgKWYR2tqR4fzgovdnXdjD148cfEuNUeDYg6EB ox+sjO4dlKV6GpiWTqoZEmrpWb52SNh178vE8dUl9JPLNMNXMcE4gysxHwpfiKZsdPwd 73pgK9Gy8Ku0oM17fiPbpqFrCS5BwIumUcGyK+vibkl2CopitASOUz9bYNG2dBDgXB+k nRPE/W4tAKVR84vc9eRn+vF2WRKnE+KMtI7vjnUUnhDKJ4vezGh0C6ZB90VR1Ge0N/Hj FrnIVdJnwsPcjKFXd1VDBXppC9CWtxE+/Mn8KigwqyrbnQgBHrf7btrPiwSbfnaoj8yU zwvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tExzcfSC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x13si5111074ejb.126.2019.10.27.14.25.14; Sun, 27 Oct 2019 14:25:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tExzcfSC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731994AbfJ0VVr (ORCPT + 99 others); Sun, 27 Oct 2019 17:21:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:42600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731982AbfJ0VVl (ORCPT ); Sun, 27 Oct 2019 17:21:41 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 AFBF6205C9; Sun, 27 Oct 2019 21:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572211301; bh=bkkkZHK4THWOGTJvtCcawwtzMIv/jQ2OkJlaPrOfbjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tExzcfSCZLMXWLUxx34vAUMadWO+5xuPNKpIQnk7svM1SkT3CPXSQ1uadZZB+hL2T YEUESA3YonQNjS2qwEDpnNBhAoaEJD+5VH5c7iHtqf2j3qEZsJOdcul80TO0OROH0C cOgJCSsj1m0K/Woxj5aVxrnWjq4DdcGh/znvuzQw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+cd24df4d075c319ebfc5@syzkaller.appspotmail.com, Johan Hovold Subject: [PATCH 5.3 104/197] USB: usblp: fix use-after-free on disconnect Date: Sun, 27 Oct 2019 22:00:22 +0100 Message-Id: <20191027203357.376019360@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203351.684916567@linuxfoundation.org> References: <20191027203351.684916567@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: Johan Hovold commit 7a759197974894213621aa65f0571b51904733d6 upstream. A recent commit addressing a runtime PM use-count regression, introduced a use-after-free by not making sure we held a reference to the struct usb_interface for the lifetime of the driver data. Fixes: 9a31535859bf ("USB: usblp: fix runtime PM after driver unbind") Cc: stable Reported-by: syzbot+cd24df4d075c319ebfc5@syzkaller.appspotmail.com Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20191015175522.18490-1-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/usblp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -445,6 +445,7 @@ static void usblp_cleanup(struct usblp * kfree(usblp->readbuf); kfree(usblp->device_id_string); kfree(usblp->statusbuf); + usb_put_intf(usblp->intf); kfree(usblp); } @@ -1107,7 +1108,7 @@ static int usblp_probe(struct usb_interf init_waitqueue_head(&usblp->wwait); init_usb_anchor(&usblp->urbs); usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - usblp->intf = intf; + usblp->intf = usb_get_intf(intf); /* Malloc device ID string buffer to the largest expected length, * since we can re-query it on an ioctl and a dynamic string @@ -1196,6 +1197,7 @@ abort: kfree(usblp->readbuf); kfree(usblp->statusbuf); kfree(usblp->device_id_string); + usb_put_intf(usblp->intf); kfree(usblp); abort_ret: return retval;