Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2467311ybg; Sun, 27 Oct 2019 19:18:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWDZyBx0GNXYWxW9jM0RvlGUCJBLKKumtGTvgp66ASJxs63GdeOcgXYh6ijDlsdod3Dm7n X-Received: by 2002:a17:906:6449:: with SMTP id l9mr14815717ejn.187.1572229111606; Sun, 27 Oct 2019 19:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572229111; cv=none; d=google.com; s=arc-20160816; b=P5b3t9d1cME3rs07PlOafkl31mYOsv90nALQb2S9cIjl22X/1lWCgdeWpN7z+wTFHO b8SZZyp1z4Tz27wNHwfDLWdUCtdzq8NVwhDeuD568nwq4pwuejgueXrj+QpEFq/RGFve IGM4HufOwEWnE65/hoEJ7sFzxpU2E18oTU96Cd185fOr+SxNJca1j+lTN3sfwk8v481a 7FB1qrNurFIR0TOgidz1d52FduPimduJcDW+J7UPJnSqRWwjGSEh5w+ic3hBXCalwPRt 5dUtG1CqJvxTG4YIks9togA82Jb6yT7OClL2yCfhwVS8v9XMIO53geGr8S4URElZ3qww NWHw== 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=wHBTylFj0Hm64+ofIRYO0/WpDMfFdGlYbisXW0hwtKg=; b=ULBx8R5Ui4OT0dqfT8+7xHlnH5mv9fELsYB7W7vHVCbLyVPBIrtHohnVBSmYwlObFu JnFRaqHVvn4j6tXQUxGj185Kotuw9qS6Ftc6hqS69N7ZFMy/6G2kHLMrmBCtmT94gZKN WQOQ+ywm/frJGR0JhNwJk9ywxJoTnWEXIe8ZAAY8YXcp3jURN+DD3vzi66FGoFVCpxOT WfAYYnEZgemDjh0BIih+FcgrkGXtT7iA3oPtQvB0ldCuDk9EV5/loOFGnMqfO33Daqbf 5K7O+4jJR5q0FnaB4n5FrVfSXRcZPvQpMEA5iCIRbg4G9O1htj5k9aEmxsBZe19WNknT lXbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R35Ohnzi; 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 la4si5089538ejb.145.2019.10.27.19.18.07; Sun, 27 Oct 2019 19:18:31 -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=R35Ohnzi; 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 S1728662AbfJ0VI1 (ORCPT + 99 others); Sun, 27 Oct 2019 17:08:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:54540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbfJ0VIU (ORCPT ); Sun, 27 Oct 2019 17:08:20 -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 41851208C0; Sun, 27 Oct 2019 21:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210500; bh=DNogohxJudpJgaAhRb6Da2/JiIzdCiOlJWxWHOT7MTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R35Ohnzic04XRpd8Rk/ruEP9lcIXjA0A4tzYjYgAFo9J3VaoBP26sI5R6MXIViuj7 0tvhQZ6FL+2VmoVZWPjY+rpbdmY08xGbMR9txpweGLJqdcj6NQwldwiA47lBEPehAQ 9K8qzM5DVNbeJK0od0WR0SUgsxuQ7TqKFbHTbTDo= 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 4.14 035/119] USB: usblp: fix use-after-free on disconnect Date: Sun, 27 Oct 2019 22:00:12 +0100 Message-Id: <20191027203311.413211029@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203259.948006506@linuxfoundation.org> References: <20191027203259.948006506@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 @@ -458,6 +458,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); } @@ -1120,7 +1121,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 @@ -1209,6 +1210,7 @@ abort: kfree(usblp->readbuf); kfree(usblp->statusbuf); kfree(usblp->device_id_string); + usb_put_intf(usblp->intf); kfree(usblp); abort_ret: return retval;