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: 20668 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DC23C25E77 for ; Fri, 27 Sep 2013 15:11:09 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id h10sf2432114vbh.1 for ; Fri, 27 Sep 2013 08:11:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=vWsqbYeTqxwajQy83XDY2W6qyY3ZIR8rowP5bXs1o6g=; b=XA1YtXs94ncx5hrm2Ai8O/3Cu1u/+/ynBdez5tWPWuDSBAFxUf9wfFxWvECyXZWliu W3rFjssHMp4hMciGry1wukQv9tpd2FYEtJnCa8oDGWAKpK6np/RUHgGO8K+FGK7RqO8s HBnYq2YQS1h7Q6LdrNrozRmwVjFDrsQLNDiC8qPQ+9AbH67yb52ivag4saKJb/SEsLVN N9iNELM+S+Q1/lgBypcZV2dvVJ5yLkhC78ghxkP8IaBB/94boDy8+STzZYpdnDAJcWG8 nZ3qSIh2Ssl2xrC+uSjnn85nsFBQ5JyscMpQI28kw3xzfK3dxkqFco11X+4M+sr0TfA1 NGAQ== X-Gm-Message-State: ALoCoQllOrznZzY95n8FSmlzwXvSmDzzmvHvklsBhZ2ZCKluq2Xh2Sgsv4hnHfYBbcGMXNIVFVIy X-Received: by 10.236.52.7 with SMTP id d7mr1207517yhc.32.1380294669349; Fri, 27 Sep 2013 08:11:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.70 with SMTP id i6ls1312939qei.26.gmail; Fri, 27 Sep 2013 08:11:09 -0700 (PDT) X-Received: by 10.59.11.69 with SMTP id eg5mr6748594ved.17.1380294669195; Fri, 27 Sep 2013 08:11:09 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id o5si1937729vdw.76.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Sep 2013 08:11:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id ij15so1958776vcb.16 for ; Fri, 27 Sep 2013 08:10:39 -0700 (PDT) X-Received: by 10.221.6.195 with SMTP id ol3mr760513vcb.34.1380294639039; Fri, 27 Sep 2013 08:10:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp433947vcz; Fri, 27 Sep 2013 08:10:38 -0700 (PDT) X-Received: by 10.66.118.233 with SMTP id kp9mr2936936pab.182.1380294637436; Fri, 27 Sep 2013 08:10:37 -0700 (PDT) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id ds3si6924507pbb.19.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Sep 2013 08:10:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of khilman@linaro.org) client-ip=209.85.160.42; Received: by mail-pb0-f42.google.com with SMTP id un15so2687150pbc.15 for ; Fri, 27 Sep 2013 08:10:36 -0700 (PDT) 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 Cc: linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org, Greg KH , linux-usb@vger.kernel.org, arnd@linaro.org, Olof Johansson 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: khilman@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);