Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2270330pxb; Mon, 11 Jan 2021 05:40:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfs3SPoyJJYMM/CKTEQfmbmssYA5evlKJdQut8/vOwlT+FiRmXe1mIkUiFzPGuyOIF7B+P X-Received: by 2002:a17:906:30c4:: with SMTP id b4mr10630392ejb.456.1610372443382; Mon, 11 Jan 2021 05:40:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372443; cv=none; d=google.com; s=arc-20160816; b=JrILatpFoG5vhrIvwpsKV2PGz3uRJAqRs9k4ttUakeW+d/xZunasLDRmeq6cfr6mRO 473sXkPgO02p3xKYipmcoiAwP4gLVHIsI8gBLPVP297NTdfXm1jcBSbObaTXX5Ggrx5c vHAZYN4Z6qsJ8pfss/p8g6lTKakv8Fd++xr4vWL8UflQBPhX+riua5BKxzOslTJnk47N 1/47q0StUs2vzYLyvzhLQW8wEI2u1TTc6vDf+5Jp3gWNcoSCM5uPCWii+pIpM6siJBDD /LsDc3s0Z78LOiLVoTntj8F3mWRYPO+gnbHdGVkG5lIjoPvTCtI4p5/RdnWiZDL8jbj8 +/Xw== 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=VWZZRNbQopH3avtdg/R3qtZPLCDQHMycgeiLbUoEOUU=; b=Gaf61KfgrINO+raMtNyxpPBLWGzWZ6qkCpI6hWvaZJJUiQodUt/FLu/gUJJTNMjOzP ta3AZIGyo+FDFDKPgFzIrrngCWz058Qc57y6DlrzT9SiIVUySkx0WjDsJWoo7FXQF1hw HErvlCqb1QGIxM2EEdOxr9R/Db61gv9eqemnAtlraRAGQRloXFWPMcL11feK9awlVXDE OMQOU/dDS5+PHsN0Tv9zUTF/Kgo7Uy2BUFLPl53zCM9fxXEeGhjx1FxrDm8OGozKVwZg Ftj4JNIFb6FDrN+7PDshtlUQAvL3MfEGr3/4lYdI/FoDg+TTqe9dBM372YK4zU1xNgzW +gvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Y8sN3Oq/"; 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 h11si6643182edw.275.2021.01.11.05.40.19; Mon, 11 Jan 2021 05:40:43 -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="Y8sN3Oq/"; 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 S1731678AbhAKNNN (ORCPT + 99 others); Mon, 11 Jan 2021 08:13:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:58310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730791AbhAKNMV (ORCPT ); Mon, 11 Jan 2021 08:12:21 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DDC5A2225E; Mon, 11 Jan 2021 13:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370725; bh=xGu95+CnD5vKduMRPLs/Rn1+Ud92sW1QnyUcoG3zxAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y8sN3Oq/O1w0ouID4IG9LD0tJGgzrXcJjiwiQ6X7tJSO/Vn6hmABnECYYI/9VOZRA 7r987+0OMc5RG7XeMOc7SaRAcYM7XlsYjz31y+YGE7Pjzx5n8dShdnwifUfJo4yIvn Bbw64OV8FMTeHEl2ccvZVXnWmWHWwEVX3QTNsTrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang Subject: [PATCH 5.4 71/92] USB: gadget: legacy: fix return error code in acm_ms_bind() Date: Mon, 11 Jan 2021 14:02:15 +0100 Message-Id: <20210111130042.571447526@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@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 @@ -203,8 +203,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;