Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2631428pxj; Mon, 14 Jun 2021 03:32:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiEMpCCbGRyN7O6tTBveB8TIB0fzfi/ZHIiXxe6WiCROy3Ye/2HjRc1FavmE6F7bWjZT2z X-Received: by 2002:a05:6402:645:: with SMTP id u5mr16439698edx.293.1623666749803; Mon, 14 Jun 2021 03:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666749; cv=none; d=google.com; s=arc-20160816; b=0ylgH1xWFQNq1rN2rkdSG9zmiq+J3SwiGCf5MRaKh3QyOAPt7JL9y5eAySvRGchjbg 6S2aBL0RUIuR0zkMZY+pISzM01fAophnGTKFbp8fqKp7XgIsl1ssZu0WSGdMcwyP1B0K 98FurkZEgTNm6H5p7w6JdowgBhlOIyO24alR8fa2QRT6vyXAFovVIIcGtE+AvJ3has0i 2UZjxbUBqeHkoYcoGXRRRFZbur5zpO1Oc90V390CLOso1CLp9aEeSqk06sES/8JBJR/F l5h5Lz7iwve4mMcGfDjFvLrnAmXUXo6yR0K1E0l9VZFcJFg7MW/HnsM+fD+a6+DwOGoV 1mMA== 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=+wV0M6O3HrRwKmQyHVhlGQV8+6jBB1ljqNVHOmFKbOM=; b=utrhiri6UXmaTrCFvKtNUHDGKE2wWJQsTWEuNuyImlDcNPmqrvov/SIF0kXzc2hifk 67QXlFZ4Q7pktcSVIEpL+MBiEddL3S09dgKpZJiEcjAmdlS5qBdTrQT0gQVg77dC6qca 4kWEqpk32bjDQ+9/8TT+Ic8Jk/Uy3PTVuU76p6PNJi7gAo4aZ7bWHlGTOXDDjQPrdR59 D+xGSG7iJbeSyStILSYNDqLtKTccGzvgPlrAqhlXSJOfa9CMSXSCQwCW86DJSbSpHeEd CCIampBn+kdlZj8U3zoXZjYG3Fc/Nbq4QPOeRM3yjRIE8Y+PMv1rEfD+auklkMVJ4XZK aRtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0QSWKwQL; 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 dp16si3289570ejc.434.2021.06.14.03.32.07; Mon, 14 Jun 2021 03:32:29 -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=0QSWKwQL; 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 S233098AbhFNKcg (ORCPT + 99 others); Mon, 14 Jun 2021 06:32:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232900AbhFNKbc (ORCPT ); Mon, 14 Jun 2021 06:31:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD063611C1; Mon, 14 Jun 2021 10:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666570; bh=IWcj35moBMRAi6GKXI6qr+oAyytUajacGc4eZxWAa3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0QSWKwQLrgY+CX88TOUvglP4Yf/WsYX7r5zMybROA2NgYlVigPw4/Aa6WEwsgF9Mc isfYRB9zYoliKx5aziWsTAtGLcrniKdGo/a1ZT+cFXcGJWCmSt/TfE8PrVqd5t4Rby F+bosU3Fhm73vvVXSP+6Mjy2cUbyCH9gdT650NfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linyu Yuan Subject: [PATCH 4.4 27/34] usb: gadget: eem: fix wrong eem header operation Date: Mon, 14 Jun 2021 12:27:18 +0200 Message-Id: <20210614102642.454007917@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.582612289@linuxfoundation.org> References: <20210614102641.582612289@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 @@ -498,7 +498,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); @@ -509,7 +509,7 @@ static int eem_unwrap(struct gether *por if (unlikely(!skb3)) { DBG(cdev, "unable to realign EEM packet\n"); dev_kfree_skb_any(skb2); - continue; + goto next; } dev_kfree_skb_any(skb2); skb_queue_tail(list, skb3);