Received: by 10.223.185.116 with SMTP id b49csp6332376wrg; Wed, 28 Feb 2018 07:43:15 -0800 (PST) X-Google-Smtp-Source: AG47ELs+TQpKE8P5547WEsieHXHnd5vNNK3kihZiiaLQzlw7G0/Ay0Cs+LmBTUd39AEPYzLJs3Ls X-Received: by 2002:a17:902:6789:: with SMTP id g9-v6mr1389971plk.167.1519832595455; Wed, 28 Feb 2018 07:43:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519832595; cv=none; d=google.com; s=arc-20160816; b=bCvyMsPV6xl0zYAToT+ol1/RW4ncb9wSA49ENtc1V89RPYbv6BqaBPi3xup83gXg4o k/3YUckxuGTNEQIx0xM5OxHNx8neu6DpsUpjfQ0sV+rwl9Z9T8OC54vfKCHm1Pz2CUOd RjZndF12R8Uo4vuZCfY2KqM7b0nLLifiEZ6xa6znJRz8g+B25k5pkbZ9T5NQN8W7oQiw xstOawCulTkWfhFp2CkwO5UpHhPVEHqqwtB1SzH81RvftyuM12iLFCfH2UK2TVWvI9u/ iBB+E6ln8cX6wuVZj0TBzjEs1XpXoo+rmDK3YbPxQ3LawjsTMA1+L+bWJmiMx2vTqfe0 GFgw== 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=kYeC/bF2kn6fhjZaaCk4lkJaVQGR5GJFEf18F/k+kCU=; b=zty6SZ70z8RCETV345CQh4hBwUhOkQ13TnKsXWWkBwNL24qzJaqM01B1pzhlBoe8cF K2An0ASYLNnMTqwJQKiax8uJLVWgxM4PV6TrdzJZthWmfX93QHzn1Q78H8omjRdgFiS0 D7ZAwv6Vut3aMga9a5UIfGu8juO/nxry0xHFY3O/Lf4T4Jn+UWbCFMyzlgALs+XhcVF6 tvltijHrzbGSKxxSfv5KRHPmArTCANC4YPj28Ax2ixNuaiwcICumqfWXeAh+uD4wQ4Nq JlvzL3ZwXJkkOXLFOmnyqL2/tzUvWwFL0Y/o2WoMKW6vpVA7cd1op9NclUkZ1r7cdHoA G6hA== 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 v1-v6si1390397plb.281.2018.02.28.07.43.01; Wed, 28 Feb 2018 07:43:15 -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 S932959AbeB1Pi7 (ORCPT + 99 others); Wed, 28 Feb 2018 10:38:59 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:33237 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752731AbeB1PWd (ORCPT ); Wed, 28 Feb 2018 10:22:33 -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-0006XU-EP; Wed, 28 Feb 2018 15:22:17 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Ye-0008Pk-3y; 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 042/254] can: kvaser_usb: Fix comparison bug in kvaser_usb_read_bulk_callback() 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 e84f44eb5523401faeb9cc1c97895b68e3cfb78d upstream. The conditon in the while-loop becomes true when actual_length is less than 2 (MSG_HEADER_LEN). In best case we end up with a former, already dispatched msg, that got msg->len greater than actual_length. This will result in a "Format error" error printout. Problem seen when unplugging a Kvaser USB device connected to a vbox guest. warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 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, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c @@ -983,7 +983,7 @@ static void kvaser_usb_read_bulk_callbac goto resubmit_urb; } - while (pos <= urb->actual_length - MSG_HEADER_LEN) { + while (pos <= (int)(urb->actual_length - MSG_HEADER_LEN)) { msg = urb->transfer_buffer + pos; /* The Kvaser firmware can only read and write messages that