From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755968AbbIUEuB (ORCPT ); Mon, 21 Sep 2015 00:50:01 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36394 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbbIUEuA (ORCPT ); Mon, 21 Sep 2015 00:50:00 -0400 Date: Mon, 21 Sep 2015 10:19:50 +0530 From: Sudip Mukherjee To: "Lu, Baolu" Cc: Alan Stern , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] USB: EHCI: fix dereference of ERR_PTR Message-ID: <20150921044947.GA6962@sudip-pc> References: <1442412485-1944-1-git-send-email-sudipm.mukherjee@gmail.com> <55FF7014.3010903@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55FF7014.3010903@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2015 at 10:48:52AM +0800, Lu, Baolu wrote: > > > On 09/16/2015 10:08 PM, Sudip Mukherjee wrote: > >On error find_tt() returns either a NULL pointer or the error value in > >ERR_PTR. But we were dereferencing it directly without even checking if > >find_tt() returned a valid pointer or not. > > > >Signed-off-by: Sudip Mukherjee > >--- > > drivers/usb/host/ehci-sched.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > >diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c > >index f9a3327..27bced7 100644 > >--- a/drivers/usb/host/ehci-sched.c > >+++ b/drivers/usb/host/ehci-sched.c > >@@ -257,6 +257,8 @@ static void reserve_release_intr_bandwidth(struct ehci_hcd *ehci, > > /* FS/LS bus bandwidth */ > > if (tt_usecs) { > > tt = find_tt(qh->ps.udev); > >+ if (!tt || IS_ERR(tt)) > > Why not IS_ERR_OR_NULL()? This was v1, corrected in v2. And Alan has already explained why this patch is not required. regards sudip