Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5215922ybl; Tue, 27 Aug 2019 00:57:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3tiZ+86o6SGJhm9shwRNOrCz+aWt2f6VH4LZhNP/t2Q5xsJ9mY2LFBDMVepE7qa/Wiuwa X-Received: by 2002:a65:6815:: with SMTP id l21mr20399941pgt.146.1566892620510; Tue, 27 Aug 2019 00:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892620; cv=none; d=google.com; s=arc-20160816; b=p3rsalbDWpE5VIfSCyL2GWoBAPecSQ4x5JSRj/9h6CJWS2k1Q5yU/YDxKnbFaG+7sR Xv6TsPIDki+0a93p8eI7N96ifmw1wBxlK51WSSYCo5iWsGIlwy+TXofhQVN2IXP8PCUs vH/dXOCb74J/AIiDkLUVlzM91ohm0/oQYMHCg6D7VpNdnUj/ggURl8ee5UmN4b7uoxHz +gl5aFyxadV+dnl4QqOq+mlgduDe5VzkStg3WwM/GL63sU1XwGQZ5XCx2C1uG1N4tWuE Ren9vt5faVexjw/ac0mj7+CR9AOIie5sHHjQdQ88/GiOFboBeqMAjFoEefr4mF47cagr 5hbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dWsnHb5fko4sdfj/LfvWBpyguxW934knE/rM2W8+Yus=; b=qyveas8cZ4L4XHFfX67wqTB8NvZCpD4GyepgP/TVIx1DLry3CxsqeUEn4gcmPYv4q9 9mhQr7W292qEjEQcpvPVUnCvbetSq0MKzeI84yaXa/zJoQxCj4Po0L1KxhxAb3J3MZTA 8f/dkF31HfWjuVNdiTB66wr5d632cJfv7amYhMHIEcSGE0jTV1FyxhwzMJ5YbcQLFRk9 lHmKC+hgavIax46fkoAx42VFi4ZbVLPUJQmhdjjDzDlIJIVCFhPeut/xpUt2brTOjvWq XHFVp/T0yF55uNt4DauId9yNVMB//CNSQEP2f1b/TmqSExEaT3UbQvmRorerMACSnEdO fFpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wRuSdoJ4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x139si11887282pgx.251.2019.08.27.00.56.45; Tue, 27 Aug 2019 00:57:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wRuSdoJ4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729973AbfH0HyF (ORCPT + 99 others); Tue, 27 Aug 2019 03:54:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:45630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729374AbfH0HyD (ORCPT ); Tue, 27 Aug 2019 03:54:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5ED6206BF; Tue, 27 Aug 2019 07:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892441; bh=TpboywqHr8Vos/+DQNJacqxYRvYbP+y0hh4/PGICnIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRuSdoJ44EvCztqyQyZRUmm5RyUnC43bwpCZRwHgan8e611CpXbSyI7iAJHVK0TiS exLBJf9jhmn0nK9xjU2nHXXNgtWDp5lxjZidnLHz+mSGkha94TeaQh3J1X3rRflbqg BWRtorcSCoEjuIeMoJPa7sS/RNp79L/7ghFq8R2M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 14/62] isdn: mISDN: hfcsusb: Fix possible null-pointer dereferences in start_isoc_chain() Date: Tue, 27 Aug 2019 09:50:19 +0200 Message-Id: <20190827072701.183544951@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit a0d57a552b836206ad7705a1060e6e1ce5a38203 ] In start_isoc_chain(), usb_alloc_urb() on line 1392 may fail and return NULL. At this time, fifo->iso[i].urb is assigned to NULL. Then, fifo->iso[i].urb is used at some places, such as: LINE 1405: fill_isoc_urb(fifo->iso[i].urb, ...) urb->number_of_packets = num_packets; urb->transfer_flags = URB_ISO_ASAP; urb->actual_length = 0; urb->interval = interval; LINE 1416: fifo->iso[i].urb->... LINE 1419: fifo->iso[i].urb->... Thus, possible null-pointer dereferences may occur. To fix these bugs, "continue" is added to avoid using fifo->iso[i].urb when it is NULL. These bugs are found by a static analysis tool STCheck written by us. Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/hardware/mISDN/hfcsusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 35983c7c31375..163bc482b2a78 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -1402,6 +1402,7 @@ start_isoc_chain(struct usb_fifo *fifo, int num_packets_per_urb, printk(KERN_DEBUG "%s: %s: alloc urb for fifo %i failed", hw->name, __func__, fifo->fifonum); + continue; } fifo->iso[i].owner_fifo = (struct usb_fifo *) fifo; fifo->iso[i].indx = i; -- 2.20.1