Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp163649pxm; Fri, 25 Feb 2022 05:53:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVFO5dgLlAu74c6SKgTzjw2FRDDTRN0UOuQL0FwCdzub4OerNEiiQg5eBZXE1OOfOxXuYw X-Received: by 2002:a17:90b:3b81:b0:1bc:d92f:d359 with SMTP id pc1-20020a17090b3b8100b001bcd92fd359mr3272190pjb.36.1645797232438; Fri, 25 Feb 2022 05:53:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645797232; cv=none; d=google.com; s=arc-20160816; b=uf5jy7sskqGCDRyEz3T7fLOBKF8XmL9B4dBFNruAbkfDIUlYr9nMSHXuj87BZstdfn L9K31XCg/FdLKY1RByYQ9chfTs9Kthdy4KzaAg7WP3um+eJq+SfuuvzRFpcqNafL38JC iRadO1uBhtA46Z/+fOsmvnX+sDIljTfsz8e3gfaXUYSwc2/tTsgcLoee0Ei1BT/qFmRe D2vPEdVKVkBBkoOKbCGp5d6k5Y2OOm+vGEkm104ac5qWaVcTGGONjoDSfgmjrhJ6mK7U KJHAfIZmJf0gLcfjXQlKmutfzguJ4CBdoHoJ6mwgoUIc1TlC3O+WKPPWT+/+SJ/Zwk4b B1jQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=715+iHDIteBSVf+EcibgL15UYpQnPyaHRHADoqHckY0=; b=CXiRIjMBe5kn/G4kL48LDYNgkK9gY1NYe7phLnMMJ4HhgUf9Vm0lDcTaV+mSzo/aaV lQwTtqjrsF37K0crCN29MqtzTWUYUNQfN5pfdTLMIclmfa6Vt7Hs7ae/6cFOYrindNWT QI2kZD9Nf7cjd+tM+rlidmVQS/Zs5CLXKjJjK7qGPmLFLZnDXSdgifb5Ygz48sXeahNe od5aqllhYBt9P1wv8rjMX7nvM0f7sWFG7H9QWqPmeMfE0oX0rDAu/zDLOrWnzPUNZAIs 1US8+BoDtvHRpnLe4nBGWKKdznSa8HdKbTmmZor7OpNINaknG/lqJniW0qQdufYn8K3e w+8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CIC5CFvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n35-20020a634d63000000b00362f44d8ec6si1875996pgl.242.2022.02.25.05.53.36; Fri, 25 Feb 2022 05:53:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CIC5CFvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237710AbiBYGBJ (ORCPT + 99 others); Fri, 25 Feb 2022 01:01:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237381AbiBYGBG (ORCPT ); Fri, 25 Feb 2022 01:01:06 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC501FE57C; Thu, 24 Feb 2022 22:00:33 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id o26so3087974pgb.8; Thu, 24 Feb 2022 22:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=715+iHDIteBSVf+EcibgL15UYpQnPyaHRHADoqHckY0=; b=CIC5CFvUXwBODJfkqpuPVIhYaZoMjAxsqXxnQFNVJeieuYuEFLck1KxZ4sVAiWgp7O tZmaJ7DSMuxb42TAfX+uyhmIGPJnbwy+Zpye5HkzYL5E5y/I2PbgTUtVdNCHR8Vfr1vB klqt9q/conYHnUkLWqXj1OHb3tLuwL27DfQqpHUACt3GnOqT7qjfOipLI5WBFx1jwhRM xThIaepJQ5Z2hxBNcQNFBJd2R2GJ2fwfdijKx1iavn3nFnapjxN5YZN/FoGnhaB/M36Q 8HiqGhAhDvB4EKSUEhvrHeRBGqAtyIY9Ap9A8XkWLt7waF91lUOEZJlfMj6fgnWmPRpS +vqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=715+iHDIteBSVf+EcibgL15UYpQnPyaHRHADoqHckY0=; b=PyJHlxJ0TKOdDiVpxcZbGWJncmuiQ9GGN1KQFFYcRiQDEMq3t2JdSKqWnWWmmG9Wtc VzW9+7r50HGyiO0ZDGnjpVcK9/bmJev0Cl4yOBX0W+1Sbsq3rcvSHQxIJ2a/thfd87Bj afusqA+6QWRxqbJ3eJU4oel1Maj8K7bHHpqLkEwIHZUcGzzv2SArmDodQGBegG/38LXQ heERMX9cUZSmsBaZ8uMaPisAxuHAXqH0NLaQmCe28hYG56lY+OcxZj72WTcipan8txcd VUK8MjAZjZpZYa0nCT0fe3o8tubdg7bHdMYA7BM+lr0BTBDK8eHKtUS0ERu00vrHsg+t VsNQ== X-Gm-Message-State: AOAM533FvfSgbERWoBFqQGrvjpuAmdF/wfBu5Ie5X/gEK6U+7i8feJsr 0jxYZRB8qzI0YksfpZUTxxY= X-Received: by 2002:a05:6a00:1aca:b0:4e1:a2b6:5b9 with SMTP id f10-20020a056a001aca00b004e1a2b605b9mr6202235pfv.4.1645768833303; Thu, 24 Feb 2022 22:00:33 -0800 (PST) Received: from slim.das-security.cn ([103.84.139.54]) by smtp.gmail.com with ESMTPSA id d14-20020a056a0024ce00b004f3c87df62bsm1491120pfv.81.2022.02.24.22.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 22:00:32 -0800 (PST) From: Hangyu Hua To: wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net, kuba@kernel.org, stefan.maetje@esd.eu, mailhol.vincent@wanadoo.fr, paskripkin@gmail.com, thunder.leizhen@huawei.com Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hangyu Hua Subject: [PATCH] can: usb: fix a possible memory leak in esd_usb2_start_xmit Date: Fri, 25 Feb 2022 14:00:19 +0800 Message-Id: <20220225060019.21220-1-hbh25y@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As in case of ems_usb_start_xmit, dev_kfree_skb needs to be called when usb_submit_urb fails to avoid possible refcount leaks. Signed-off-by: Hangyu Hua --- drivers/net/can/usb/esd_usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 286daaaea0b8..7b5e6c250d00 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c @@ -810,7 +810,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb, usb_unanchor_urb(urb); stats->tx_dropped++; - + dev_kfree_skb(skb); if (err == -ENODEV) netif_device_detach(netdev); else -- 2.25.1