Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2663955pxj; Mon, 14 Jun 2021 04:22:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6Z2Nno6APZbG9b4OXNaLzHlSssTDc8ZwuTCWH6t3so4fn2Vr7N7vZfm57ybwGR0pSpon3 X-Received: by 2002:aa7:c54c:: with SMTP id s12mr16492053edr.374.1623669750927; Mon, 14 Jun 2021 04:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669750; cv=none; d=google.com; s=arc-20160816; b=YqbrvErVyQC9n+n9rKygBcpi7sT58vIB44rdBpnOkqmLXl0lPVJ6Qq+mByt5BeaGgy 9TMGKqpoqya9JIHAI5a9g+cAVlWMq4TeIfhFfAuHuoItY6gR5yKGbQE/Ex2D8uo/ahfK Q4vP2A2T3Wk+tN96j4VbrWNhJuyBNnv5EQpm+nQzy7PJ0QariGLbPbvdBC60QhOKl0gY vzxmSHujPrGDLYEDe/SYXf8IBmeBaGJZT3qJTg2b+NHYfaezgoXxLVCJaXX3whG0EQMs joCYTiR68s+Pfplal5fOxcHSx9GsKDPVVEkvjrGW6BSgG398xJyBSprKNJ2rzToNexeh pLhw== 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=qa8pJ/BGKwoezBn8Em908Izsz6XUyRqVuQwrnCjKbt8=; b=h316V/mxfP57y15rEwIFWozxBzzzuWUEgva0nYUg03DK3+/lAN+5X3dffeRG4T1ZuW fPRCECGe3hme+DjS00K/ThQ4S5oA6xgjbS9JUtbBYTOh7defn1Npbho5mt9w2NbaSV3l xvANiE6gQYxbUt2WGDBYJPoB0oWhZQI7BdQ3J3sgcRthzusjbtz6ApbunfBhpdL/rKsF 49CN/5mfP8MFCiyMV9vkn2yE51Wwap52kzG+SPVZ/E6z3JaN/OcZ1ZD3mjpylgoWVykp LGbdJ5HmvKpvIo6vNIps/fsYuzoSBfMkzC7oPWDcUoSh2kbK6G4eB1XDAccLZMEI4VDR 42Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ii3OCpr2; 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 t26si11075049edf.425.2021.06.14.04.22.09; Mon, 14 Jun 2021 04:22:30 -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=@linuxfoundation.org header.s=korg header.b=Ii3OCpr2; 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 S235949AbhFNLTw (ORCPT + 99 others); Mon, 14 Jun 2021 07:19:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:41710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234200AbhFNLHW (ORCPT ); Mon, 14 Jun 2021 07:07:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 682A96192A; Mon, 14 Jun 2021 10:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667560; bh=GXkKJAaY1quZ0z2weVFfgkenet1vk6/lym2c5MlOqU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ii3OCpr275atJlctsDDD/L96uX68Q85nAcC8O7X5CR93W0SJc1WZdcA5cx7DNh5WP Fgv9CcVwfgLZW7H+b4eCcEqMzqiFYpMN24bqzSgc10TiwUBIVE4AKjN0hygZkbXHDG RGrWBR02wADwlvHMTKjwSG27F8g5ZvH8Uk6herk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linyu Yuan Subject: [PATCH 5.10 085/131] usb: gadget: eem: fix wrong eem header operation Date: Mon, 14 Jun 2021 12:27:26 +0200 Message-Id: <20210614102655.896101325@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@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: Linyu Yuan commit 305f670846a31a261462577dd0b967c4fa796871 upstream. when skb_clone() or skb_copy_expand() fail, it should pull skb with lengh indicated by header, or not it will read network data and check it as header. Cc: Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/20210608233547.3767-1-linyyuan@codeaurora.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_eem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c @@ -495,7 +495,7 @@ static int eem_unwrap(struct gether *por skb2 = skb_clone(skb, GFP_ATOMIC); if (unlikely(!skb2)) { DBG(cdev, "unable to unframe EEM packet\n"); - continue; + goto next; } skb_trim(skb2, len - ETH_FCS_LEN); @@ -505,7 +505,7 @@ static int eem_unwrap(struct gether *por GFP_ATOMIC); if (unlikely(!skb3)) { dev_kfree_skb_any(skb2); - continue; + goto next; } dev_kfree_skb_any(skb2); skb_queue_tail(list, skb3);