Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2039186imm; Mon, 16 Jul 2018 00:40:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeG5fZrTO6YP2p4jqIk0+/wnlEaD7MrGOpLbIaMB8jN1C+dpcTk0drt/ienKhvCL9nTkIjT X-Received: by 2002:a62:d646:: with SMTP id r67-v6mr17135355pfg.130.1531726800365; Mon, 16 Jul 2018 00:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531726800; cv=none; d=google.com; s=arc-20160816; b=BScpxymUGCvu3t5VQQ9WFyU23VPcylhSastVUC6qMT2h/mIe7huiiOWYwqIbRhYkSa lD27tGokQ9dSo0nOO0jaPDj0mHZNZvvUEF7T9XFxGiV4cmC1bdMrOXEKBjEgQJfsR0hn xRfcPygxPbrOpwbudlWcJ/R2PqstMFY7TWtM/O4JsfE9CkLGhsciHrAIv6P2QQPXdWIW 84/pwo/dFj4EDaUF9sSBwLc3U+Wu1zCcDF3xp2lGvbGNkijMmF+36liGrG+5/I+szKbk cr+L3GrdelZxeZeDlPHeSCO29imia8JSq2tiYag85NSS3tm3BldS0lmExHCvIJtW7opk jy5g== 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=sc2hDdqSnjBz00T8T/xg7DyB3tnZeOJLHUXolkHbbpY=; b=sHGEOKMbyDE8ziJE22DM4WXa+pmOUczyZF5i/U16uqD9hQa8AOMnbXmOj7gerWhpZG ykRYHNL2/M8+i7nqiHapxf9f82RtXx2/L7jzgtJAYPbrNmM6tvmPTOurGrAUg7iOqoQq AbslujIAq9X1WNSS0KCzCNmkhvxxH6qtFHOyBoM494xX9ohr2mwaYZtitNZtsZWAXW34 ngzFLuDjoZSqabIMdrTQX3Ut/Nqtgml9hnrUXO9ls5yoTr7AA1i2R7YYe/yQU9jc4hPm TTQATKjX7bLHP69lGnEyMdMQfdQSHadJ5hrIv1JEhZF6Itid+4Y3VsiMzZheNpaqPPRX y4ew== 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 i124-v6si2443937pfc.110.2018.07.16.00.39.45; Mon, 16 Jul 2018 00:40:00 -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 S1731416AbeGPIDR (ORCPT + 99 others); Mon, 16 Jul 2018 04:03:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46682 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728460AbeGPIDQ (ORCPT ); Mon, 16 Jul 2018 04:03:16 -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 8A3D7CA0; Mon, 16 Jul 2018 07:37:15 +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.17 24/67] USB: serial: ch341: fix type promotion bug in ch341_control_in() Date: Mon, 16 Jul 2018 09:34:53 +0200 Message-Id: <20180716073446.814256215@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073443.294323458@linuxfoundation.org> References: <20180716073443.294323458@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.17-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 @@ -128,7 +128,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",