Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2043355imm; Mon, 16 Jul 2018 00:46:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcFH3/6Q+QVHohWyMubvGN7InhG9Jz6OSZtwNNedN+iiSMaGjBbleEElyKN2UCDvvr4zloa X-Received: by 2002:a17:902:1005:: with SMTP id b5-v6mr15872822pla.207.1531727162319; Mon, 16 Jul 2018 00:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531727162; cv=none; d=google.com; s=arc-20160816; b=MvHwTNQzoaufKAdGROVC3Z9m8W1+BoZroqQT6SjmSmBOJjJtBTiTEyWmSHKMWwuX4J Y0pWkUqw1xHD+Dpq+880RSDHoSxdgUaQNcOPUw2u7SU6MgaCZe4NL/LbVKS3w1E0nvmt g7CnlNr64c/nXji8M2RqKwKxT6oSksQoOphGKeg+2ZwRf97mV9iu5gDku8FPolGiX/+n AwnTdicdZScVJnrh+LvnIgSYNN3QdbGvoW7fkDKw+476FCwKiFOhVm2W7p0qdNjSK0qT prKpnv2EEq2bxFB22qCVjc+awG6iJTaO6lUjo3Ik87EiGCO0s6OgvM39FgFQnDOP5Z/M VlBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yaDwlZfNlE1WhEoIL76WotK3VSBzDwyZ86u5mIatwZ8=; b=o5SFlUXeU6flWykZh6AYngFcSgBCe1xSR3nCxe2xVEPYcjwxWarSobZS/W7neT1HH+ AURXM3bPt10N6DNY7a/Xmz5FLUT4XwY+/V64k6WWajlGbdNewAi54GuMrA2BrMQ/1OZj otWHHGCw09r/vbn9Acuah7GXghvCkjdydVjXg4yyh2cxzd/GuVIIb2QphIPxMGmVm/qI eScs7K34la1QwOyJyHQt5L0w+AuWoPuuUDBzPmZ9Z38MvCCmC2iVFuPN1FPVIU9hCBbV 5WwWYNRo00QdYHPxzsvAb+dVVpxSzYDraihB9ZFp7utYwbV2MviztJA/NC82U7MGHRRs kW6g== 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 m5-v6si2679154pgk.533.2018.07.16.00.45.47; Mon, 16 Jul 2018 00:46:02 -0700 (PDT) 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 S2389376AbeGPIKg (ORCPT + 99 others); Mon, 16 Jul 2018 04:10:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48218 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388522AbeGPIKf (ORCPT ); Mon, 16 Jul 2018 04:10:35 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 14CAEC03; Mon, 16 Jul 2018 07:44:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Johan Hovold Subject: [PATCH 4.4 05/43] USB: serial: ch341: fix type promotion bug in ch341_control_in() Date: Mon, 16 Jul 2018 09:36:10 +0200 Message-Id: <20180716073512.359855760@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073511.796555857@linuxfoundation.org> References: <20180716073511.796555857@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit e33eab9ded328ccc14308afa51b5be7cbe78d30b upstream. The "r" variable is an int and "bufsize" is an unsigned int so the comparison is type promoted to unsigned. If usb_control_msg() returns a negative that is treated as a high positive value and the error handling doesn't work. Fixes: 2d5a9c72d0c4 ("USB: serial: ch341: fix control-message error handling") Signed-off-by: Dan Carpenter Cc: stable Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ch341.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -118,7 +118,7 @@ static int ch341_control_in(struct usb_d r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, value, index, buf, bufsize, DEFAULT_TIMEOUT); - if (r < bufsize) { + if (r < (int)bufsize) { if (r >= 0) { dev_err(&dev->dev, "short control message received (%d < %u)\n",