From patchwork Mon Oct 5 21:31:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 11817875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F5E96CB for ; Mon, 5 Oct 2020 23:38:50 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DF7F206CB for ; Mon, 5 Oct 2020 23:38:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.elisa.tech header.i=@lists.elisa.tech header.b="UvCCLIT1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DF7F206CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+72012+65+4688437+8417402@lists.elisa.tech X-Received: by 127.0.0.2 with SMTP id ROGNYY4689772x5OHqYuGDVq; Mon, 05 Oct 2020 16:38:48 -0700 X-Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web10.31.1601933528064505995 for ; Mon, 05 Oct 2020 14:32:08 -0700 X-Received: by mail-wm1-f67.google.com with SMTP id z22so865357wmi.0 for ; Mon, 05 Oct 2020 14:32:07 -0700 (PDT) X-Gm-Message-State: sWQV8Fv6k3bqBOiAhvd1aYH1x4688437AA= X-Google-Smtp-Source: ABdhPJzZRxNQ/305lZa0njFqzSW0QW0eoQM1oNffk9v2kzF6D9dfQMiMJZvwTogMHAlr2n5+uPeulQ== X-Received: by 2002:a1c:f214:: with SMTP id s20mr1302967wmc.84.1601933526399; Mon, 05 Oct 2020 14:32:06 -0700 (PDT) X-Received: from localhost.localdomain (host-92-5-241-147.as43234.net. [92.5.241.147]) by smtp.gmail.com with ESMTPSA id q9sm1474013wrd.57.2020.10.05.14.32.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Oct 2020 14:32:05 -0700 (PDT) From: Sudip Mukherjee To: Alan Stern , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-safety@lists.elisa.tech, linux-usb@vger.kernel.org, Sudip Mukherjee Subject: [linux-safety] [PATCH] usb: host: ehci-sched: avoid possible NULL dereference Date: Mon, 5 Oct 2020 22:31:49 +0100 Message-Id: <20201005213149.12332-1-sudipm.mukherjee@gmail.com> Precedence: Bulk List-Unsubscribe: Sender: linux-safety@lists.elisa.tech List-Id: Mailing-List: list linux-safety@lists.elisa.tech; contact linux-safety+owner@lists.elisa.tech Delivered-To: mailing list linux-safety@lists.elisa.tech List-Post: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.elisa.tech; q=dns/txt; s=20140610; t=1601941128; bh=cP5ny1247heN5l/Bfg4WeQXvTiN15XtVqiqpffL7hK8=; h=Cc:Date:From:Subject:To; b=UvCCLIT1oCP/qh0s2/hzyGvCkvOXbFDJ+Gn2M1rkZasffIAMprprRyQ/fDJ0TVX0BsY 2ecUtpB9wNvzIfkitu1cxTg2VbBjJyCqqU/ULFcmsKgzBMK3ZMdMVOh3m3OQTTSBOusI+ PC3edZBywVwn9J+mxYWVP9T09vHFH/3Dm0c= find_tt() can return NULL or the error value in ERR_PTR() and dereferencing the return value without checking for the error can lead to a possible dereference of NULL pointer or ERR_PTR(). Signed-off-by: Sudip Mukherjee Reviewed-by: Harley A.W. Lorenzo ps.udev); + if (IS_ERR_OR_NULL(tt)) + return; if (sign > 0) list_add_tail(&qh->ps.ps_list, &tt->ps_list); else @@ -1338,6 +1340,8 @@ static void reserve_release_iso_bandwidth(struct ehci_hcd *ehci, } tt = find_tt(stream->ps.udev); + if (IS_ERR_OR_NULL(tt)) + return; if (sign > 0) list_add_tail(&stream->ps.ps_list, &tt->ps_list); else