From patchwork Wed Mar 20 15:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10862117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 143EC14DE for ; Wed, 20 Mar 2019 15:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDE0329A0A for ; Wed, 20 Mar 2019 15:27:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1E1B29CC9; Wed, 20 Mar 2019 15:27:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F05829A0A for ; Wed, 20 Mar 2019 15:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbfCTP1S (ORCPT ); Wed, 20 Mar 2019 11:27:18 -0400 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:35834 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbfCTP1R (ORCPT ); Wed, 20 Mar 2019 11:27:17 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 34774628 for ; Wed, 20 Mar 2019 15:27:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l5Z7WdfL1XPv for ; Wed, 20 Mar 2019 10:27:16 -0500 (CDT) Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id EBE81964 for ; Wed, 20 Mar 2019 10:27:15 -0500 (CDT) Received: by mail-it1-f198.google.com with SMTP id i63so2607222itb.0 for ; Wed, 20 Mar 2019 08:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=gRegdW0Vp32TTwcRwpYr4FmCrFCirUJNOAYEJ5vzjtw=; b=J3+DENYuvYqwCOu+pPdJN+D2rPCmz2ActBpNZtlQS0s1N3ufbgHzTJa+pF/kc2mb89 0gCJMAW5LPC3I+KBSHvHSJGBFwCFwX+iptQ7650iMKljz8C1w5BwNuqdXwElp2LwLtZc zQh+5ANjwtAU3fFw1wtmuPtxuJY6AdHLKIbLdL0EFvH5v4FpMRvIv5tcroZkHZUJR0LY Fxpbh7UJy+hGNHeq+QdXzXx5fXljJYnVTv6STeZQ+oQYXO+p2bzTZpY9/bI3Zaz2hCXa 99Pcdz7gOYMFCg7H8lpzfcFTV/49bpdcX7RtgBBCzXfHVy9KOy+Dj2pDfzn4sVDOqtGf aB/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=gRegdW0Vp32TTwcRwpYr4FmCrFCirUJNOAYEJ5vzjtw=; b=evhKnktqT6yt75BzoLHFEJ014o42ism1GWxq+ba4vzxmqxxUb1+3nBU0ctEK3nh0Ok xekEd7T5lEZli6DZpv5t96qptGWGFDkkh4tmbgK3YuKj4as8qv97b6RoN/vuIQqemKoJ eBeVoawtO9+ViFfqXJm4hHz6jgCn/TDdrtFpXpVbxYEEKVC3hnfYL/qZP15iXa/WFl1L PU1rcC0ehkXvbnWRjbCru0GWvfKusqsayfDDYCe05STjANnpyvFEM241UsTAbwFotY9g mNWMsSmk9deHa/mWeey04qc2p1RwXg9Bn4m1saPKiuEi5/5XiDhk49Itt9Wlj2g9nEoa VBGg== X-Gm-Message-State: APjAAAUQy8OTJDrufVpOlG2krG/6S6fwboZZI4hv5GshFCAq3l3TxXed YbiJuwhyqJE3zFuOUACinqts/0dTRVkFQ2AKQaA+yeSf0CouJ96Qqc8tucKsoG1HlzJLznx0EuF QwupQkJ2ZTBvUviQkn5aMEqUr X-Received: by 2002:a02:b510:: with SMTP id l16mr5491652jaj.13.1553095635498; Wed, 20 Mar 2019 08:27:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBV7QdKKUjEZ1/gxxhpw0SlCp9GmDwccNurPAzXuaqQ17sJ/z1lFlUDEvyrThV2c7t9oCfTw== X-Received: by 2002:a02:b510:: with SMTP id l16mr5491615jaj.13.1553095635019; Wed, 20 Mar 2019 08:27:15 -0700 (PDT) Received: from cs-u-syssec1.dtc.umn.edu (cs-u-syssec1.cs.umn.edu. [128.101.106.66]) by smtp.gmail.com with ESMTPSA id l62sm1195945ita.12.2019.03.20.08.27.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 08:27:14 -0700 (PDT) From: Aditya Pakki To: pakki001@umn.edu Cc: kjlu@umn.edu, Richard Leitner , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] usb: usb251xb: fix to avoid potential NULL pointer dereference Date: Wed, 20 Mar 2019 10:27:11 -0500 Message-Id: <20190320152711.28749-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_match_device in usb251xb_probe can fail and returns a NULL pointer. The patch avoids a potential NULL pointer dereference in this scenario. Signed-off-by: Aditya Pakki Reviewed-by: Richard Leitner --- v2: Fix version changes below sign off v1: avoid return in case of error, per Richard's suggestion. --- drivers/usb/misc/usb251xb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c index 4d72b7d1d383..bbfdb7447d6f 100644 --- a/drivers/usb/misc/usb251xb.c +++ b/drivers/usb/misc/usb251xb.c @@ -612,7 +612,7 @@ static int usb251xb_probe(struct usb251xb *hub) dev); int err; - if (np) { + if (np && of_id) { err = usb251xb_get_ofdata(hub, (struct usb251xb_data *)of_id->data); if (err) {