Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5692616imu; Wed, 30 Jan 2019 01:52:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN6LLmHsS5KoXltEKLNaqm0RU+evvdw8Eofd+Kfw92nTL9qf1z/41dj/LPexTJxxaNySF4yU X-Received: by 2002:a63:d604:: with SMTP id q4mr26648723pgg.175.1548841928243; Wed, 30 Jan 2019 01:52:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548841928; cv=none; d=google.com; s=arc-20160816; b=srH2feY9zPYoIMijbajLex8B5oyBlKqsyrVH9mt9ODeJ2BLzPeiCDldWVT2dOlMZ8S Y2gmsHXPGqvtq0sCvi3MixkNy6gGWd1KudnlQZIpaDr2fmr+5ahoxIQvX5buKy6Ream5 lC/yPOhKukDgmunyDntY877N1BnCiJPKvpEsU3wIg0+VKu0pGBDFdb6QSe8HQWBhU1wE nZG6Ki1bpM1fWn1dlcCWh7siVRhchhK9OMVY/hfhxicOh2sFDZsIMNDbVw4BiRAy7Qy5 5ocwvs6mlRXFAepiaz51Uf3u70E/rJp6/SyCQykzduzPIN154NLkKlDtM/xB6Wt8RnVS 0vxw== 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 :message-id:date:subject:cc:to:from; bh=NanYgte5LFdggF1rtBl08xezcfm+tdZaDruR5cWG55Y=; b=U89BqlxQo4FjV046VBnNDQ1Lg+79EA/MRp2kgHF4WLoxehotpgBcIuT0Dgp8/8ilBC Md78m5o5nZFCAOZ+uUGNPcfjNw106OmIJwuZIkvJnVPsQT7QtXa1L4kXw2i0JMVJCgvg VKh7de20l1+3aqW+xHNRrmo8t03aLI/cksHZz1LAxVBnoKbFy+s+KH9LBXzufghpB1Ar EDjSG7gPHBJki+ubh/ekfEj/WgSkUCrSEN55FbfqGBIGA960KyWthGD2f0YZRWVTZz4l 8cdHLwlniJXGZEsVdYHoaMs+eCNqQ9AhTu8b0Iif9gwC97/LuKmwOhOTQ4geS6v2IxQD 87bA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si1036064pga.87.2019.01.30.01.51.52; Wed, 30 Jan 2019 01:52:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729665AbfA3JuR (ORCPT + 99 others); Wed, 30 Jan 2019 04:50:17 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46531 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726972AbfA3JuP (ORCPT ); Wed, 30 Jan 2019 04:50:15 -0500 Received: by mail-lf1-f65.google.com with SMTP id f5so16860183lfc.13; Wed, 30 Jan 2019 01:50:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NanYgte5LFdggF1rtBl08xezcfm+tdZaDruR5cWG55Y=; b=YV3q/GSkZbYzq/BToC2dyD0Klg3M6VQiBKiohDw+U/nJ7lKMf6D++n06NUys9xI9MF PiScQNObINpjA+02ANz83fJ0gga5XywcI2FHBGbhVjkcRR/axDDdgAA+18UMcOP0sUOs Wh+ZGz6PiBUBcV+OZaJNYkXBXt9+bzaxCxa0g6Z4mMsnCOxfXgmRNkSnpM8tuYmho9Fd pc1ZfmgC+xi0Qc1G4nHgT+elfCO6hyTo5kY7I6hzHS+9MG2cRh2fiDmqfeHgvHr3sVxh xz82z9+O3YtKAjKkNCrQ8CtsrNIeAw/dhYpYGWdynNkOlvlwK9EZQR/Vvvg9xNnsci/7 tvFA== X-Gm-Message-State: AJcUukd/ikwnm35o/tgHv/vKddKAwL4iXGooHfY5UmYd1QHUo0oPRAjx /BIyCS4CjZ+MMc3OACOZizw= X-Received: by 2002:a19:4345:: with SMTP id m5mr22821843lfj.142.1548841813454; Wed, 30 Jan 2019 01:50:13 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id b25-v6sm188574lji.94.2019.01.30.01.50.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 01:50:12 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1gomVU-00017G-MP; Wed, 30 Jan 2019 10:50:08 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Okash Khawaja , Samuel Thibault Subject: [PATCH] staging: speakup: fix tty-operation NULL derefs Date: Wed, 30 Jan 2019 10:49:34 +0100 Message-Id: <20190130094934.4231-1-johan@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The send_xchar() and tiocmset() tty operations are optional. Add the missing sanity checks to prevent user-space triggerable NULL-pointer dereferences. Fixes: 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input functionality for tty") Cc: stable # 4.13 Cc: Okash Khawaja Cc: Samuel Thibault Signed-off-by: Johan Hovold --- drivers/staging/speakup/spk_ttyio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index c92bbd05516e..005de0024dd4 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch) return; } - speakup_tty->ops->send_xchar(speakup_tty, ch); + if (speakup_tty->ops->send_xchar) + speakup_tty->ops->send_xchar(speakup_tty, ch); mutex_unlock(&speakup_tty_mutex); } @@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear) return; } - speakup_tty->ops->tiocmset(speakup_tty, set, clear); + if (speakup_tty->ops->tiocmset) + speakup_tty->ops->tiocmset(speakup_tty, set, clear); mutex_unlock(&speakup_tty_mutex); } -- 2.20.1