Received: by 10.223.185.116 with SMTP id b49csp6338801wrg; Wed, 28 Feb 2018 07:49:51 -0800 (PST) X-Google-Smtp-Source: AH8x2252R/7XMtKbZWLQhWmSwK7b6I4z7dZz/MYrYQJhyD7M1iFP+NM9qCVbMOUXCW451EhwU64b X-Received: by 2002:a17:902:9a84:: with SMTP id w4-v6mr18510838plp.136.1519832991408; Wed, 28 Feb 2018 07:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519832991; cv=none; d=google.com; s=arc-20160816; b=QW9qGE1oPc4phtm2AkxWTFEb4gqs/RAmwlOd5P8UoLbJlpbPs33+V0XYiwRkkEaQBF LhbOqQxrL593Q64+ZWkB4jsu1zXs7VoUKz590n+CWnGKC5Bc5M70AWMJKXS9uDaPCUga dmr22MwbVpDFBUx0Q9IbSBtfd8Zu5erdQRNrSdHwMYiD18TxEXsjEmb/D/vryRZP1hxg pAlBO5g1Jc+jpN6THHgv1mmBB4ZRhfNLJYRnWz7I1VskyG6ja8YsccJKqLIeb59pVj5V vncJNvnwlSbVfPRmTP9FmR3mIcnvkg+oNmEZJHB0OMaAiKPZsz7zEvvSmBdrtzztqUNJ D9Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=GxsYNgPuMGa6IsCTcNVkK7YZ34cE8sLpAKn+JBz473c=; b=a/EFpPQfb8nVeAjqnjWAhNYioOrn6cx1XOQfIqsthMRgGmhak6qC3rnewn1WHC7LsV ySjxQ/lp0oIvCX2YcxQ8hemJxhTQkwWDpFqGM33NJBq6nVsNBHA7kzN8nt4NS9/NHfnb ckaXZSCuV3Nb5mH+kl2NNcCdBEQbjngFTKkb+WjnLTQEShNDPfQAaqMO8P5tThn9BGjL wz5X/4FHgro6DJntyF3oqAvO1CZZK7f8OY5w6ElPK9o2NeplCWzC8O4HEbblXkxYKB1w h7kYILJnUImOvPwiAoI0BkLxzrD3lEay6vJpQLzwVjLP9TltSiKuRCI3YiqUqZIyj0O6 RcQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r62si1154203pgr.77.2018.02.28.07.49.36; Wed, 28 Feb 2018 07:49:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933594AbeB1Psn (ORCPT + 99 others); Wed, 28 Feb 2018 10:48:43 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34271 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933174AbeB1Psj (ORCPT ); Wed, 28 Feb 2018 10:48:39 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yf-0006Xj-EP; Wed, 28 Feb 2018 15:22:17 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Ye-0008Pf-32; Wed, 28 Feb 2018 15:22:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jimmy Assarsson" , "Marc Kleine-Budde" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 041/254] can: kvaser_usb: free buf in error paths In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jimmy Assarsson commit 435019b48033138581a6171093b181fc6b4d3d30 upstream. The allocated buffer was not freed if usb_submit_urb() failed. Signed-off-by: Jimmy Assarsson Signed-off-by: Marc Kleine-Budde Signed-off-by: Ben Hutchings --- drivers/net/can/usb/kvaser_usb.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -608,6 +608,7 @@ static int kvaser_usb_simple_msg_async(s if (err) { netdev_err(netdev, "Error transmitting URB\n"); usb_unanchor_urb(urb); + kfree(buf); usb_free_urb(urb); return err; } @@ -1406,6 +1407,7 @@ static netdev_tx_t kvaser_usb_start_xmit spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); usb_unanchor_urb(urb); + kfree(buf); stats->tx_dropped++;