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, 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 B98EDC2D0E4 for ; Thu, 12 Nov 2020 19:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DF0F21D7F for ; Thu, 12 Nov 2020 19:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727069AbgKLTZ2 (ORCPT ); Thu, 12 Nov 2020 14:25:28 -0500 Received: from netrider.rowland.org ([192.131.102.5]:46225 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727022AbgKLTZZ (ORCPT ); Thu, 12 Nov 2020 14:25:25 -0500 Received: (qmail 288074 invoked by uid 1000); 12 Nov 2020 14:25:24 -0500 Date: Thu, 12 Nov 2020 14:25:24 -0500 From: Alan Stern To: John Boero Cc: 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: <20201112192524.GB287229@rowland.harvard.edu> References: 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 Thu, Nov 12, 2020 at 06:15:08PM +0000, John Boero wrote: > Then why does line 278 right below it check for NULL? Are you asking about line 278 in drivers/usb/core/usb.c? The statement which says: if (!config) return NULL; This is because it is perfectly valid for config to be NULL at this point. But it is not valid for dev to be NULL. If dev is NULL then there is a bug in the caller. Alan Stern