From patchwork Fri Sep 27 15:10:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 2955561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6B9BCBFF0B for ; Fri, 27 Sep 2013 15:11:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 455E520155 for ; Fri, 27 Sep 2013 15:11:17 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E0882011B for ; Fri, 27 Sep 2013 15:11:12 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPZhC-0003Rt-3A; Fri, 27 Sep 2013 15:11:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPZh9-0007dE-KW; Fri, 27 Sep 2013 15:11:03 +0000 Received: from mail-pb0-f43.google.com ([209.85.160.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPZh6-0007c3-Lw for linux-arm-kernel@lists.infradead.org; Fri, 27 Sep 2013 15:11:01 +0000 Received: by mail-pb0-f43.google.com with SMTP id md4so2665615pbc.30 for ; Fri, 27 Sep 2013 08:10:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=vWsqbYeTqxwajQy83XDY2W6qyY3ZIR8rowP5bXs1o6g=; b=hZyC718+KNu6D4KTo9KZZslIqE/yvw6/eEL4fT1n3FW6tgrNY3IMPuzXT5bxw+z+ts gdrpnqQMCWPeh9Q/hOFEDNLjKJU1MZxnuamBKPLA6SBFGrYECy5IilcK1VqDEc4cciP1 oDY5OTmJbymp9XGAI+xP8ktcxhLYDoHC6JHJ97dBxGJAKVHnG7WK2MNhCbp3O3115emc 6kLjCxWYNOYhe6ioVOOkz9AdMnMMeiKlK605A8EA8j1+XuWtFZVx/htSgk1+9Q69emRW Ohi5zsE8uEIkRqoYRT3n4V9xQpajz3NOht9Jd6Yq+uiLdRQgYAGPYsprjnG3fgHSOHQW LgIw== X-Gm-Message-State: ALoCoQn7rKQs+y/CI7KBjHLBfy4OQy335OjstuKeCLYksfp9hY0p8OAQzAOuJBFwYpUdO521RwmJ X-Received: by 10.67.23.71 with SMTP id hy7mr11927162pad.99.1380294636804; Fri, 27 Sep 2013 08:10:36 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPSA id go4sm9402901pbb.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 27 Sep 2013 08:10:34 -0700 (PDT) From: Kevin Hilman To: Manjunath Goudar , Nicolas Ferre Subject: Re: [PATCH V5 5/9] USB: OHCI: make ohci-at91 a separate driver References: <1370585013-12809-1-git-send-email-manjunath.goudar@linaro.org> <1379761727-10656-1-git-send-email-manjunath.goudar@linaro.org> <1379761727-10656-6-git-send-email-manjunath.goudar@linaro.org> Date: Fri, 27 Sep 2013 08:10:32 -0700 In-Reply-To: <1379761727-10656-6-git-send-email-manjunath.goudar@linaro.org> (Manjunath Goudar's message of "Sat, 21 Sep 2013 16:38:42 +0530") Message-ID: <877ge2l2qf.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130927_111100_822203_5C2AAE8E X-CRM114-Status: GOOD ( 16.84 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, Greg KH , linux-usb@vger.kernel.org, Olof Johansson , arnd@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Manjunath, Manjunath Goudar writes: > Separate the TI OHCI Atmel host controller driver from ohci-hcd > host code so that it can be built as a separate driver module. > This work is part of enabling multi-platform kernels on ARM. This broke booting on atmel sama5 boards (and likely others with the same conversion)... [...] > +static int __init ohci_at91_init(void) > +{ > + if (usb_disabled()) > + return -ENODEV; > + > + pr_info("%s: " DRIVER_DESC "\n", hcd_name); > + ohci_init_driver(&ohci_at91_hc_driver, NULL); ohci_init_driver() doesn't have any sanity checks for NULL overrides, so it blindly dereferences and faults. Some of the other conversions have this same problem (at least omap3). Did anyone test this series on hardware? I'm not too familiar with OHCI, but something like the patch below is probably needed along with this series. Kevin From a3b5cc90e74038a6449fbd25e0d720ea02884f30 Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Fri, 27 Sep 2013 08:07:19 -0700 Subject: [PATCH] USB: OHCI: ohci_init_driver(): sanity check overrides Check for non-NULL overrides before dereferencing since platforms may pass in NULL overrides. Signed-off-by: Kevin Hilman Acked-by: Alan Stern --- drivers/usb/host/ohci-hcd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 21d937a..8ada13f 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1161,10 +1161,12 @@ void ohci_init_driver(struct hc_driver *drv, /* Copy the generic table to drv and then apply the overrides */ *drv = ohci_hc_driver; - drv->product_desc = over->product_desc; - drv->hcd_priv_size += over->extra_priv_size; - if (over->reset) - drv->reset = over->reset; + if (over) { + drv->product_desc = over->product_desc; + drv->hcd_priv_size += over->extra_priv_size; + if (over->reset) + drv->reset = over->reset; + } } EXPORT_SYMBOL_GPL(ohci_init_driver);