Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1412961ybl; Sat, 10 Aug 2019 03:14:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3ZjV0/JQuu+PHQ5DoXR4aoHVzE3/WflwR8eYwjLhJHo18Z4IZJGzo6OIcKpoyKKYlVzmi X-Received: by 2002:a17:902:e20c:: with SMTP id ce12mr24283688plb.130.1565432042536; Sat, 10 Aug 2019 03:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565432042; cv=none; d=google.com; s=arc-20160816; b=hTTXHGmQVudP/9SlmI+3xQbkOfv5tL549pv+PA2u3CLnJC7jRm2AnC0vcIeDulcPTM 0wAAntXqw/rDX1Z85hb+oFza6JqjoH9sAaol6KrqTi1a3iVgrDv8wJ0AlXkmSM0a1d6S W4yl8/6wJvXTUeVioiN9QJ5As+wiuhCV7RJWolgzSzTn6HgwsWqa3/zDHhkTCgSDCn7z kZx94KWNyT9AxX0REO9E10AoqfuvXcxI73P/9PooD6K5hXnksbsioPofDezOWMr1+2pH LRVq41TOfEvQIpYpAlsy7xscJq/x6Dt6n3K/x2hobjMo8+nZkRt7kKL6o7Ucz0VADByy bEFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=I8JXMAOA9TvA6KvRUhv7EDQ9wCqEK8XF6Bl/05suwJU=; b=MWMO41rjG2ZsPf2cnVIJhCobeJ8WPMMPaBRYQiojadkI8c+xHlyBzGwh1IPi2b4H48 pzARGIA6YLUkEkoLj+D08JJIv6xWYxMw5PkKyBoQTpaWT/AdeRlpfhiWqS6teo56cQDj 5HpHOWu1tSTgLy66Kkx6pIOaQGN3GkpDc0IjFMwhZycN9ZOTudF/SoLINq6wVtIUmhoi 5DbSokL3foxz9OkYAYZ5ZPNHKOl/5XZYiVpslPe8UeO0hnl/9+xG4Q7chv6Dr6bsi6F0 YWHXIZi+GcpJRQr0hHTA9bvM3aVIetefcg/lJn0o9/r0pfRhwMoos9joetoIhBv2y5Wz gg5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ctNhXmpS; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si51091522plo.328.2019.08.10.03.13.36; Sat, 10 Aug 2019 03:14:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ctNhXmpS; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726192AbfHJKNU (ORCPT + 99 others); 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