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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 2379BC433E0 for ; Sun, 24 May 2020 11:05:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECD412077D for ; Sun, 24 May 2020 11:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbgEXLFY convert rfc822-to-8bit (ORCPT ); Sun, 24 May 2020 07:05:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:43536 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbgEXLFY (ORCPT ); Sun, 24 May 2020 07:05:24 -0400 From: bugzilla-daemon@bugzilla.kernel.org To: linux-usb@vger.kernel.org Subject: [Bug 207871] nullpointer dereference in uvc_video_stop_streaming Date: Sun, 24 May 2020 11:05:23 +0000 X-Bugzilla-Reason: None X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: AssignedTo drivers_usb@kernel-bugs.kernel.org X-Bugzilla-Product: Drivers X-Bugzilla-Component: USB X-Bugzilla-Version: 2.5 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ranma+kernel@tdiedrich.de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: drivers_usb@kernel-bugs.kernel.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Bugzilla-URL: https://bugzilla.kernel.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org https://bugzilla.kernel.org/show_bug.cgi?id=207871 --- Comment #2 from Tobias Diedrich (ranma+kernel@tdiedrich.de) --- Interestingly, usb_set_interface() already calls usb_ifnum_to_if() once, which did not fail. Then after calling usb_disable_interface() it calls usb_hcd_alloc_bandwidth(), which does another call to usb_ifnum_to_if(), which faulted with the null deref. The fault is at: mov rax, [rdx + 0x398] test rax, rax jz early_exit_since_config_is_null [...] mov rcx, [rax + rdx*8 + 0x98] inc rdx -> mov r8, [rcx] movzx r8d, byte ptr [r8 + 2] [...] So I think the fault is at [...] for (i = 0; i < config->desc.bNumInterfaces; i++) -> if (config->interface[i]->altsetting[0].desc.bInterfaceNumber == ifnum) ^^^^^^^^^^^^nullptr return config->interface[i]; [...] usb_set_interface() only checks for dev->state == USB_STATE_SUSPENDED, maybe it also needs to check for dev->state == USB_STATE_NOTATTACHED? The disconnect message indicates this would have been the state the device was in, from usb_disconnect(): [...] usb_set_device_state(udev, USB_STATE_NOTATTACHED); dev_info(&udev->dev, "USB disconnect, device number %d\n", udev->devnum); [...] -- You are receiving this mail because: You are watching the assignee of the bug.