Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4414826pxa; Mon, 10 Aug 2020 08:33:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFSocNXfGFhMNbyh+DeZ6IEwSwu/b4eF9qPnmXsFC6F7tCTquk6DHNGhuynORsRuDQEJcI X-Received: by 2002:a17:906:e0e:: with SMTP id l14mr20926078eji.398.1597073585649; Mon, 10 Aug 2020 08:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073585; cv=none; d=google.com; s=arc-20160816; b=RUvt9OUVuqaqMfPg6ouINrpdiWB7hjNeCzsXXCPDoOyxVtk+6dShDHqviLRGip9ajs HrWOeybtXeAcc2o/A8GwiqOzbRSnVbPaiOzaBg2KDlIshVQNBhGP1edWK40bifov9X+8 Xm2sfR4PP3/8IkqhBzFnbxKsIDsA4vBR/vZ5uMt3yjjlalfzejrTh4uqhIwaEBCdaOUU n1Dw/DpYUy1VNegk4dDtgGHpM4pqh2GyoqdxDl8K3pS+5J6fF9zY6sobZKCm/XicT2tj GukhtVU8aQzXqG2qV9mn3vGwtjSNlKfLrK0M51JGm+LEwExba97jB60a4G7vX8jNcIfM YYmQ== 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=Y/urUrMMLLY0UJmJ7dxeRSD9pHXTcaM27W0aQq0JYlA=; b=h7Af2FniTYTsNRQ67mLgc5hxWc1JcaTDXTVpvIwviAOA6x5Q9KFKoIrwx6FmBDCjMr BVBLMaqLjP0DI8yUGFm1x/ROhpFs0j6wSTkNVzb3SHQId/RaLzT5B1LphzlT2eXtcf37 7HzcXR6SYPlFHwScPcb2NM99PgRRoDe/nnv2jQjWGH1Pik7OJTmpXhOl91DXdvjawMVc /EoahFQEYfq91LvaR69BOEV/2wPPUhD/IzEn/eHgKJkJJHqR6RMry3l3ce0AlDdZUlMS ocdxmw5s9Na4F9vSB4dPNIjGjwQDEpzkz2aSNskl9jGpLLV0FJoJc13JAx3rYgOU/MhT aJRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CK1Blwm0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ci17si10502190ejb.743.2020.08.10.08.32.42; Mon, 10 Aug 2020 08:33:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CK1Blwm0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728680AbgHJPax (ORCPT + 99 others); Mon, 10 Aug 2020 11:30:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:37842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729125AbgHJPap (ORCPT ); Mon, 10 Aug 2020 11:30:45 -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 C5CF920791; Mon, 10 Aug 2020 15:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073445; bh=HQuKcHKaMPUKXcAswKyAx8FwNMuuuNSyoqwuF+jeTs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CK1Blwm0V3tYI+1np2632NwTYlwDLfrx42T7g8maGYXTlimNOxJMmIYv8cN0XocaZ jt5/suA6XV5TuQ/beKRfskrZuWAewfw7zQH5rKjyqLfdWk5KDJIPHoDZoSCSbAQ600 CguVBjS60wzTxCFiKltvuWBQ2gZmJ/laNmFmbYCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Kovhaev , "David S. Miller" , Sasha Levin , syzbot+67b2bd0e34f952d0321e@syzkaller.appspotmail.com Subject: [PATCH 4.19 24/48] usb: hso: check for return value in hso_serial_common_create() Date: Mon, 10 Aug 2020 17:21:46 +0200 Message-Id: <20200810151805.404508512@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@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 From: Rustam Kovhaev [ Upstream commit e911e99a0770f760377c263bc7bac1b1593c6147 ] in case of an error tty_register_device_attr() returns ERR_PTR(), add IS_ERR() check Reported-and-tested-by: syzbot+67b2bd0e34f952d0321e@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=67b2bd0e34f952d0321e Signed-off-by: Rustam Kovhaev Reviewed-by: Greg Kroah-Hartman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/hso.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 61b9d33681484..bff268b4a9a46 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -2274,12 +2274,14 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, minor = get_free_serial_index(); if (minor < 0) - goto exit; + goto exit2; /* register our minor number */ serial->parent->dev = tty_port_register_device_attr(&serial->port, tty_drv, minor, &serial->parent->interface->dev, serial->parent, hso_serial_dev_groups); + if (IS_ERR(serial->parent->dev)) + goto exit2; /* fill in specific data for later use */ serial->minor = minor; @@ -2324,6 +2326,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, return 0; exit: hso_serial_tty_unregister(serial); +exit2: hso_serial_common_free(serial); return -1; } -- 2.25.1