Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1354309ybp; Thu, 17 Oct 2019 11:30:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4DJ8TC3z0w2auQr4WfVtk5EqK2CMHlmE3gDMJiexAhOiA9lf6FLqyBzCpo0XBxPgeq8sP X-Received: by 2002:a17:907:2095:: with SMTP id pv21mr4656384ejb.324.1571337051368; Thu, 17 Oct 2019 11:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571337051; cv=none; d=google.com; s=arc-20160816; b=bfB9mO1imzo+PK0NHOQHti6BtPlHqWATWggOtRVIcLpkUn6Nx7wryfmVsPXdYGofLX ns0mezjm7JhZSowKLehLVSeaohEV6cBiAFueK0mZWdUckJ/cgz8d/cMhoZmRbONqtuxC HPycwFzV20nrbP85AqOFkRWZVO8N7TsrCJskvH92G8ZaRWtMDwME6TE9w2U1RN+8AdyT x95VUTZW8YOK6GwOmCl7lRVXqEOJCC1P9bCCbyq9gwTLLhV25LDCKyo5m9c4mVENIaS/ xmCM9XKc4927q9HzhYddq5mZ8VHkoHjzvKeXlwjOzR5lAQ8t3B05eCHFBbEzGL4VHeTr 4UYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XMDFp63fsT8ZE1LAg72LrMBrj7D1t8geot3Dp9biCHU=; b=kLR+iGcQbF8MqNsc6tgKZNmBcEvIZLPPwUVkZZy8rPkb8bjt6gPbH5J+bKP7WwWnKo xlbL0OTk2/69ZMyxHj5m5pP+rGG9zEtoUqMmXs/NKZAn2B4L/GxZZ4Y4k6Kea7SC6WJ9 LB6aMTKaDDDoWNA7Aeuv3FGyWo6uh6z7t2qo1q16gxirR3bShm3j0CwY+pL0OS8AkTog pfs/eP/01C1rvcXiCB66hQaBftuFgy/YKu95qo6j/KvAuo/N2uS12EqqzOIzxDYXrza1 gor88/HPcivxii7o11NFsATDmE/wg+Ob2dREoxCjf14geyqL6WV/1J0dDvBl0AwK48HC 73+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gPqOncP2; 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 u23si1821259ejr.204.2019.10.17.11.30.28; Thu, 17 Oct 2019 11:30:51 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gPqOncP2; 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 S2392465AbfJPWGO (ORCPT + 99 others); Wed, 16 Oct 2019 18:06:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:52344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438198AbfJPV6f (ORCPT ); Wed, 16 Oct 2019 17:58:35 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 270EB21925; Wed, 16 Oct 2019 21:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263115; bh=KBAU9OMK2sBXQWd9cYoO7tzeT75xTCJgt3hVD5ITMPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPqOncP2g45v1l7j3t29ptCeeWqMZzQhgWlZaaiLB2+Q8T+1AZpx2Tct6eJF9lA3F KchbnSKYBlT/3fyae+URMqBNBVvUEVj8FfHQn5dimLqV5aTO8xSvSHQze01y0vUs5A XGs/4/ZQd8nbO8mXrUEA4Hk9q0d559ZlG3fNc4hA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.3 039/112] USB: legousbtower: fix slab info leak at probe Date: Wed, 16 Oct 2019 14:50:31 -0700 Message-Id: <20191016214854.216542720@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 1d427be4a39defadda6dd8f4659bc17f7591740f upstream. Make sure to check for short transfers when retrieving the version information at probe to avoid leaking uninitialised slab data when logging it. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20190919083039.30898-2-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/legousbtower.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -891,8 +891,10 @@ static int tower_probe (struct usb_inter get_version_reply, sizeof(*get_version_reply), 1000); - if (result < 0) { - dev_err(idev, "LEGO USB Tower get version control request failed\n"); + if (result < sizeof(*get_version_reply)) { + if (result >= 0) + result = -EIO; + dev_err(idev, "get version request failed: %d\n", result); retval = result; goto error; }