From patchwork Wed Jul 4 15:02:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10507173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DEC2D600F5 for ; Wed, 4 Jul 2018 15:03:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF82428D81 for ; Wed, 4 Jul 2018 15:03:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C38D228D84; Wed, 4 Jul 2018 15:03:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C25A28D81 for ; Wed, 4 Jul 2018 15:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752653AbeGDPCx (ORCPT ); Wed, 4 Jul 2018 11:02:53 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:41194 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbeGDPCv (ORCPT ); Wed, 4 Jul 2018 11:02:51 -0400 Received: by mail-lf0-f68.google.com with SMTP id y127-v6so4605965lfc.8; Wed, 04 Jul 2018 08:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=d2LKKVEs8aBTMDFYD+93iTSZ/P1d7tf9JWWTTurZK7g=; b=CtUfWToM2URknUe2VQXG05mafgUJfVOULj61xrvQIOeZg7Mlhape2B7fVSJcaeW0LU D5jOOnmFz4CGvD39x916lRWQXSAITDZ2DgVPRsu00xchdrL81dQ48hWEQyU5WHyGOire i/r7Mmu1Lev9VIExp9myNGpZIhmN/POyCCqCz5mcm3owDbxIBGSvy5FR8Ip3JU/IVQ6w Y9PFhcwD6INk9dHsD4QJ5kw+pHjrhW7EzjWYBW/1iUjr+egA0C6/wHtzqcdKB77zYVtl xqZjGLPvJ8QDqG1mKr6WMM5sdY7Uz6QyGnQe4HLmOhwg2Et/3BUJNIYMZyrIdyHo5xmh 70DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=d2LKKVEs8aBTMDFYD+93iTSZ/P1d7tf9JWWTTurZK7g=; b=hoKUnyNfaDtLvL8hWfIm+0y9HTE8poP5ljC5vx3M4c7ktXLpBFAk0zuOjhUaKnBYM+ FR/c0EvQsXjVtot3g4ZthZwgbEJiJDwtvRIN2IKDuhmZcdcezZH5/JQ3UByofLUdWKRr tooE605gP9G29nITKKa/AqpzfWT5+8/UwI+vcvvDLVKPgXrMoc+W6VkcmaRAYFuU8/ds 7fLQwyrHodyKbDW5+hP6y7zaADuYeTSfLzkSkaQhZn3YumuuTtC+ITRv9DY8EyGLXGnL IS6hUrgPC6id4wqwlt4g75GpmOM1/1JXRJ3CipY9d6lHNOptlmxUA/16ac6i6qEJ+a/T s5pw== X-Gm-Message-State: APt69E2HNEmJJEz9rHT9fPM1CZ7+RH/oUEplyGb6jdpWAcdJ1UKrNS2D gl4vsnf+SBMlVVe63Q6JcfE= X-Google-Smtp-Source: AAOMgpfXmq8RWbBkTK6ldMnHX1eJF2dSy+DI6HNVI+5nlzdJjAQvktcHpfOBhcChxStaj8HryN7xPg== X-Received: by 2002:a19:cd08:: with SMTP id d8-v6mr1932206lfg.41.1530716570011; Wed, 04 Jul 2018 08:02:50 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id z17-v6sm827066lfb.5.2018.07.04.08.02.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 08:02:48 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fajIl-00078W-VN; Wed, 04 Jul 2018 17:02:40 +0200 From: Johan Hovold To: Johan Hovold Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, stable , Benny Halevy Subject: [PATCH 1/4] USB: serial: keyspan_pda: fix modem-status error handling Date: Wed, 4 Jul 2018 17:02:16 +0200 Message-Id: <20180704150219.27389-1-johan@kernel.org> X-Mailer: git-send-email 2.18.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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") Cc: stable # 2.6.27 Cc: Benny Halevy Signed-off-by: Johan Hovold --- drivers/usb/serial/keyspan_pda.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 5169624d8b11..38d43c4b7ce5 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -369,8 +369,10 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial, 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;