From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F395C76186 for ; Mon, 29 Jul 2019 20:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5302205F4 for ; Mon, 29 Jul 2019 20:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564430711; bh=g3Qa5pRkKnZVNZExxBrPTdWu2N5wP1p8syJV2zVv3rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jC24bdUpJNVkjibSSKdOkBU73Ipy1GtIzDpMfSGK8n9+3LKASG7PBALiOoxxXnEfb F2JpY2HTkUrFsvmPFJh/Z/D/LVIKEt3op9fGRST0GqxKgZN+NKUB8mAWUkZMrusfRr X5K0d0hVe8dtqsEm3yX+/o+SyZDq7J64J7NSwB68= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390335AbfG2UFK (ORCPT ); Mon, 29 Jul 2019 16:05:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:60652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389705AbfG2ToB (ORCPT ); Mon, 29 Jul 2019 15:44:01 -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 8C6A1205F4; Mon, 29 Jul 2019 19:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429441; bh=g3Qa5pRkKnZVNZExxBrPTdWu2N5wP1p8syJV2zVv3rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tqvt1ZUPKvbaj0oEbVKEmI5gPREhUpyJH+SQ+xNxGzm6zyuZIcm7JyZUIkd2bqxMg ibbxtYoSAqBp8BqK7+UQMV7bx540+WXh6rwEgXsUf0UK4my+sLJTGHKp1r5k0WhcU5 GCTzXlhaj5unnolvTezANxxVntRIlEMBxUPM2R+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+fd2bd7df88c606eea4ef@syzkaller.appspotmail.com, Phong Tran Subject: [PATCH 4.19 098/113] usb: wusbcore: fix unbalanced get/put cluster_id Date: Mon, 29 Jul 2019 21:23:05 +0200 Message-Id: <20190729190718.955497803@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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: Phong Tran commit f90bf1ece48a736097ea224430578fe586a9544c upstream. syzboot reported that https://syzkaller.appspot.com/bug?extid=fd2bd7df88c606eea4ef There is not consitency parameter in cluste_id_get/put calling. In case of getting the id with result is failure, the wusbhc->cluster_id will not be updated and this can not be used for wusb_cluster_id_put(). Tested report https://groups.google.com/d/msg/syzkaller-bugs/0znZopp3-9k/oxOrhLkLEgAJ Reproduce and gdb got the details: 139 addr = wusb_cluster_id_get(); (gdb) n 140 if (addr == 0) (gdb) print addr $1 = 254 '\376' (gdb) n 142 result = __hwahc_set_cluster_id(hwahc, addr); (gdb) print result $2 = -71 (gdb) break wusb_cluster_id_put Breakpoint 3 at 0xffffffff836e3f20: file drivers/usb/wusbcore/wusbhc.c, line 384. (gdb) s Thread 2 hit Breakpoint 3, wusb_cluster_id_put (id=0 '\000') at drivers/usb/wusbcore/wusbhc.c:384 384 id = 0xff - id; (gdb) n 385 BUG_ON(id >= CLUSTER_IDS); (gdb) print id $3 = 255 '\377' Reported-by: syzbot+fd2bd7df88c606eea4ef@syzkaller.appspotmail.com Signed-off-by: Phong Tran Cc: stable Link: https://lore.kernel.org/r/20190724020601.15257-1-tranmanphong@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/hwa-hc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c @@ -159,7 +159,7 @@ out: return result; error_set_cluster_id: - wusb_cluster_id_put(wusbhc->cluster_id); + wusb_cluster_id_put(addr); error_cluster_id_get: goto out;