Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2672508pxb; Mon, 11 Jan 2021 16:46:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZF0yYvHk9BSnfAav0cQeRbM7S0B9wJyhYqs9VGPltde3QWNybsHmrkrhJ8mwo9X7g7G7l X-Received: by 2002:a17:906:68d1:: with SMTP id y17mr1357281ejr.447.1610412374891; Mon, 11 Jan 2021 16:46:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610412374; cv=none; d=google.com; s=arc-20160816; b=UY7YDJaDbx6WA7o8Q7ow6YpK0VkzntmdAc5v0qyRnPuYULV9ktCKrv3ZKZ8qwqvHfl rMdBY2Dw3OrGZu1AewLmaWFgjUvvfTbupcLYaRzXrpcXzJbwYUuWEkDau6tlLyPoojYr Cm5AvfU2DcRiuG0qaAK3ObFj8R8Q5R67UXp273X8kot1V+Nj6JF7Q8PLAKC7LBDS9QRJ kEMF5bKnFSxWTwJk5FYWfCaq3JR41Mqa4aRsjEV2yBdQuDtp7qRqrxI7bjYk60GqOSh+ AxIRHAeROTcuxYpfHdVibdMM6DHLVtHUZmQ3ecqX15KMxw6STVB9XfwI2TrInTLoSMek oU7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sTpRV2S0z4iDvIrZxoN1LUFejFAmhY5ANDZ574/liV0=; b=03QZ9MTcTZffQGnNrDH46qyO65NYB+YGz91WAB5eiGCha+JU21NJ29gYc1hHa1b7YN emCr7y9xZK2ePFX74BR6boevAxWQRkuxbM4nexbeKo1UeMJFtqPrZMd0ysgybP99Yt+4 VvMUgukKGhtPfrW4B7x2KFyodlgvinKvZB25KadC2/NN2IXGQWb+xS7wvFhEFL4OoQou TRSFqR2+m1PhlCacAWjZZy2gTM9B4uAkK9EvA3c0LvVp27YZH837fTYU9IA29q9HY6nq IAxvya4qQqfDmQPnYxxdjvlRG/k17CKkBHmQGtn5GC0gg2+UJJY7UN4Ybtbpn+MmsY9I bIIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FnrA9S9f; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s2si551424eds.424.2021.01.11.16.45.50; Mon, 11 Jan 2021 16:46:14 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=FnrA9S9f; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729671AbhAKNDN (ORCPT + 99 others); Mon, 11 Jan 2021 08:03:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:50168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729176AbhAKNDJ (ORCPT ); Mon, 11 Jan 2021 08:03:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BFF42250F; Mon, 11 Jan 2021 13:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370128; bh=rwPYVE94HfNpJFsSt+E5hlbIoXRvehJRH/rC2WXnwAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnrA9S9fdFFP2VujjSvdmEGOkJvnmV0ZWThdCRlVZnFpsYrIkAjJBbqJY3Rawu3gt fXOSyKiY9qUtBpdxaiFQWfHPbYl/1HFd2WEOmvzsXEIUZt34CdWn5se3sTD2w2ji3V UQsBb5C6yMipqB9Xf/9h2a/NIh2Yj4O/VMSoOcZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang Subject: [PATCH 4.4 29/38] USB: gadget: legacy: fix return error code in acm_ms_bind() Date: Mon, 11 Jan 2021 14:01:01 +0100 Message-Id: <20210111130033.864180020@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130032.469630231@linuxfoundation.org> References: <20210111130032.469630231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang commit c91d3a6bcaa031f551ba29a496a8027b31289464 upstream. If usb_otg_descriptor_alloc() failed, it need return ENOMEM. Fixes: 578aa8a2b12c ("usb: gadget: acm_ms: allocate and init otg descriptor by otg capabilities") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Cc: stable Link: https://lore.kernel.org/r/20201117092955.4102785-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/legacy/acm_ms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/gadget/legacy/acm_ms.c +++ b/drivers/usb/gadget/legacy/acm_ms.c @@ -207,8 +207,10 @@ static int acm_ms_bind(struct usb_compos struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto fail_string_ids; + } usb_otg_descriptor_init(gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL;