Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3924507pxj; Mon, 21 Jun 2021 09:29:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz3MOVj2dqIS98Hk7KMenJCY69FTi9rmsNQRtede7i8HXlpJfmz+6VmVZYOvWqGGhlpo6K X-Received: by 2002:a92:ce91:: with SMTP id r17mr11101968ilo.168.1624292958481; Mon, 21 Jun 2021 09:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292958; cv=none; d=google.com; s=arc-20160816; b=IyS+YE99DdEUfyNEiYop4i9Gqfe407ndXftoAJZbGDVLJi+YZpwDAbGWSCLdf4o2N4 0s7zzywqRnK8jumUJIbdgE8xigbafavtaoy22sB4USPqlZJa87kIaOZxKjhughNG7qsC /aYInANYbZ3aSKKfg3NrhJccmn1I8D5/r8B66/NCTxifv3K7luoI+fRIHIFht1NCOasx 9V3g4YZU2chBI/i+311N/g0PLWa1LhakTzyfeeGZ7G6dKtoidhwApMoXkywI0zGctnb6 02lX86IpXSRIRdlyy1WEy5fGY76CtMd3vuUbD6mnObmbnrUx2P3NdumGZkrPWAxYQCti tK/A== 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=2Kr0YJpk4e/0mzk57zndX+qAweo+A9OnnZWeyL4bILI=; b=VQwqfuGxJTIpPsfl1qYzV7oTD2AsyaKgtVBP+9sI4s3Xjzy7TKU4JUnSKAPAml+Mbn Ue55x3ghDBHqbFgBYcCqIfkjXoAbHY+hN02MGC8Cerepu+5ugO85lz5OtmGPpSpIFsTE uD7j7KnnExQPXcQUa/cZBnhTcl7abQ9rqyHtPRxQtfKgeF73REmcv2UEdtKjZn9XrKYN h7MtHThR+k5d7hw1/WOBC/jCKwTLGJkUfLy85TD4MC86zZyS5Ofl1o+thr3SO6fXQX8s yD7jU7cZyDC4CpknT+8gySbU+8oBaQDscXBDpc2a/n/bDGJNu8NDpaEUoxmNL1sNgF9/ 5U3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bVTGIUkf; 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 i9si12471500ila.58.2021.06.21.09.29.06; Mon, 21 Jun 2021 09:29:18 -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=bVTGIUkf; 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 S231374AbhFUQas (ORCPT + 99 others); Mon, 21 Jun 2021 12:30:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:49586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231529AbhFUQ2l (ORCPT ); Mon, 21 Jun 2021 12:28:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 50E11611BD; Mon, 21 Jun 2021 16:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292619; bh=eTN+BlV+f0iQcq7YZMIiD7nRsr9dem6v+4GLnTTvicY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bVTGIUkfIs420HjS0fxodZXAkPgOh04o4VKM9Xy0UQze5ihynSGAm9YpJzuW5zwar JC4Pc0sxqSxBCSKJLKe3OcadWXTfUaqHDi9Hdrw7Xk8Z7CwpbNVb9KCNClnK5oKH9w LdU8QanF5uLLkdZA1+LOwuLWTWtAv8YVJbrAVIx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linyu Yuan , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 067/146] net: cdc_eem: fix tx fixup skb leak Date: Mon, 21 Jun 2021 18:14:57 +0200 Message-Id: <20210621154915.027220035@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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 [ Upstream commit c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7 ] when usbnet transmit a skb, eem fixup it in eem_tx_fixup(), if skb_copy_expand() failed, it return NULL, usbnet_start_xmit() will have no chance to free original skb. fix it by free orginal skb in eem_tx_fixup() first, then check skb clone status, if failed, return NULL to usbnet. Fixes: 9f722c0978b0 ("usbnet: CDC EEM support (v5)") Signed-off-by: Linyu Yuan Reviewed-by: Greg Kroah-Hartman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/cdc_eem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 0eeec80bec31..e4a570366646 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c @@ -123,10 +123,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb, } skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags); + dev_kfree_skb_any(skb); if (!skb2) return NULL; - dev_kfree_skb_any(skb); skb = skb2; done: -- 2.30.2