Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3309769imu; Sun, 11 Nov 2018 12:05:56 -0800 (PST) X-Google-Smtp-Source: AJdET5e9qn987sRyPN8Y9JktBwQVrCyiwUkI6EgkXzB83oncIZWPvVP76mt2zJP4RoccVDRe6VWb X-Received: by 2002:a62:2c16:: with SMTP id s22-v6mr17219953pfs.6.1541966756273; Sun, 11 Nov 2018 12:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966756; cv=none; d=google.com; s=arc-20160816; b=tau8Cl2BKemfXay/gkCN8gIxtkWVyjWQ1sbryx551zr8NS2pep0B6WORkx1GS0qsQu eTwTj/4IogV/BlPsHnLWdCV9EEVxnzupd1zl7Bu0YOXrr2U6uByaionbBwaghoBudYiH ijn8iAf3gBndI16Q1Eo0AMzFPc5tmH3A4MPXb7QZt58gT5Vm5R1g3dpgd1j8jN+FWpgF IqTVBKLiB3cRmNtSa6pnrxKvrvFIXq9ERzLLAl5m6wgzGI2ljp55sXRlm0a4Aph2y9BL HsMgeORcntJvKamRC9q9nGxdXRAlRL0/0QaIW0Xj+wDNiYhEe8adNsgMvbYAY9xgy2K8 qeaQ== 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; bh=IOb0fyU3UVyyuKrdinz2s01Jw0DAdZ7lXC+IawyBGcU=; b=DCacKgA0NQ+KglO8YDpHwmRjfch/eN5+zqNaUJUmVJss+w/AUmFkgBfAkECHfyDirb 0wHxKZBJQP5dXhykoW9KWlLdNlqFsKsPck9CxHQsKkuGHX3nC4a/EA68lSpcR9gSDLD5 LVkMT5u76JkiLXPw6SwCyNePxDT6GzlotCrNN5iX4ARpWgUV2QGobM92ae+kMFIyDyIs H5BKo/5p7f60UqHZ5WR7CocqSI2Hmsz6NrObOI1In6CUAX/xEqBr2pzc+0Wthyme6HcL ZIdPqxRPY/zekFhhc6qns4pfcb8Ff2NYJtFnvJYhkHfBRG8zxlhZmvD1AU4QKVjALUvR 8wHg== 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 k68-v6si13743296pgk.294.2018.11.11.12.05.41; Sun, 11 Nov 2018 12:05:56 -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 S1730827AbeKLFwt (ORCPT + 99 others); Mon, 12 Nov 2018 00:52:49 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51136 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730702AbeKLFsb (ORCPT ); Mon, 12 Nov 2018 00:48:31 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvss-0000oP-1T; Sun, 11 Nov 2018 19:59:02 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsV-0001gq-No; Sun, 11 Nov 2018 19:58:39 +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, "Johan Hovold" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 235/366] USB: serial: keyspan_pda: fix modem-status error handling In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 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.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 01b3cdfca263a17554f7b249d20a247b2a751521 upstream. Fix broken modem-status error handling which could lead to bits of slab data leaking to user space. Fixes: 3b36a8fd6777 ("usb: fix uninitialized variable warning in keyspan_pda") Signed-off-by: Johan Hovold Signed-off-by: Ben Hutchings --- drivers/usb/serial/keyspan_pda.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -373,8 +373,10 @@ static int keyspan_pda_get_modem_info(st 3, /* get pins */ USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN, 0, 0, data, 1, 2000); - if (rc >= 0) + if (rc == 1) *value = *data; + else if (rc >= 0) + rc = -EIO; kfree(data); return rc;