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.3 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_SANE_1 autolearn=unavailable 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 734BEC433FF for ; Sat, 10 Aug 2019 10:13:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 460FB20B7C for ; Sat, 10 Aug 2019 10:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565432010; bh=xxIhXdXrNYgZy+a1g/JRW7MbrkKrZsW0bGELVlqKFBw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=t59BSsNtGMGKFPbY4wXJDp5FbHej/ufetYKDXrnHi/C+5YMHq9Zh4P/tQ2sB5Ma1w PEyCwKaLV5fjtxpTmWTsmS3qSKZ/FvEWihpgfc1Gv/qt5hMcD3G542JNSGxJthkwO+ ONnfhtAqnr/xD2a/YDnuMNsHIiSDyM1ifIqeTTEM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726216AbfHJKNU (ORCPT ); Sat, 10 Aug 2019 06:13:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbfHJKNU (ORCPT ); Sat, 10 Aug 2019 06:13:20 -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 B843F20B7C; Sat, 10 Aug 2019 10:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565431999; bh=xxIhXdXrNYgZy+a1g/JRW7MbrkKrZsW0bGELVlqKFBw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ctNhXmpSiavk41/UgdlWjh3DR1JDGpe5VWInUhTHszrusWwCkZaAmxC6jIUdY2FHV WOR9mLzjaFF7r1+VZHaHZ09n8gH+N129bspBw9zh8UeR3rEg+hamoROySGQMbpy+uU TY6AqrvLV+JiYnGsRTGCsiaRfmDNOW2q7ucmvdHo= Date: Sat, 10 Aug 2019 12:13:16 +0200 From: Greg KH To: Hui Peng Cc: kvalo@codeaurora.org, davem@davemloft.net, Mathias Payer , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] Fix a NULL-ptr-deref bug in ath6kl_usb_alloc_urb_from_pipe Message-ID: <20190810101316.GA25650@kroah.com> References: <20190804002905.11292-1-benquike@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190804002905.11292-1-benquike@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Sat, Aug 03, 2019 at 08:29:04PM -0400, Hui Peng wrote: > The `ar_usb` field of `ath6kl_usb_pipe_usb_pipe` objects > are initialized to point to the containing `ath6kl_usb` object > according to endpoint descriptors read from the device side, as shown > below in `ath6kl_usb_setup_pipe_resources`: > > for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { > endpoint = &iface_desc->endpoint[i].desc; > > // get the address from endpoint descriptor > pipe_num = ath6kl_usb_get_logical_pipe_num(ar_usb, > endpoint->bEndpointAddress, > &urbcount); > ...... > // select the pipe object > pipe = &ar_usb->pipes[pipe_num]; > > // initialize the ar_usb field > pipe->ar_usb = ar_usb; > } > > The driver assumes that the addresses reported in endpoint > descriptors from device side to be complete. If a device is > malicious and does not report complete addresses, it may trigger > NULL-ptr-deref `ath6kl_usb_alloc_urb_from_pipe` and > `ath6kl_usb_free_urb_to_pipe`. > > This patch fixes the bug by preventing potential NULL-ptr-deref. > > Signed-off-by: Hui Peng > Reported-by: Hui Peng > Reported-by: Mathias Payer Reviewed-by: Greg Kroah-Hartman