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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 9F982C55ABD for ; Fri, 13 Nov 2020 17:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F03922226 for ; Fri, 13 Nov 2020 17:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726273AbgKMRQq (ORCPT ); Fri, 13 Nov 2020 12:16:46 -0500 Received: from netrider.rowland.org ([192.131.102.5]:57705 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726028AbgKMRQp (ORCPT ); Fri, 13 Nov 2020 12:16:45 -0500 Received: (qmail 327091 invoked by uid 1000); 13 Nov 2020 12:16:58 -0500 Date: Fri, 13 Nov 2020 12:16:58 -0500 From: Alan Stern To: John Boero Cc: Laurent Pinchart , Greg Kroah-Hartman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: core: Null deref in kernel with USB webcams. Message-ID: <20201113171658.GF322940@rowland.harvard.edu> References: <20201112192524.GB287229@rowland.harvard.edu> <20201113163449.GB322940@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 04:45:52PM +0000, John Boero wrote: > Sorry I wanted to include a pastebin or link but was trying to follow maillist > guidelines and not include links or exceed wrap guidelines. Full contents: > https://paste.centos.org/view/3746bc40 > > Yes I understand the return dodges the config dereference. > > Original line usb.c:281 is the original error: > > 280| for (i = 0; i < config->desc.bNumInterfaces; i++) > 281| if (config->interface[i]->altsetting[0] > 282| .desc.bInterfaceNumber == ifnum) > 283| return config->interface[i]; Okay. Without having looked at the code, I would guess that uvcvideo's uvc_ioctl_streamon() handler -- or some routine beneath it -- either doesn't lock the USB interface while starting I/O, or doesn't check (while holding the lock) to see whether the driver has been unbound. This sort of error (config->interface[i] == NULL) is what you expect to see if a driver tries to carry out I/O to a device that has been unplugged and that it has been unbound from. Alan Stern