From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CAD5C282D7 for ; Mon, 11 Feb 2019 15:04:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0F69222B1 for ; Mon, 11 Feb 2019 15:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897463; bh=cZGFX5Ht4a2et4aDTtyOA8yFoHMmEH30JKSY8aac+Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bASuMEfbCs3fHagjxB1Dz9ED09hm5HpVG8ogM+2sbK7NWc5GUwZTOvScESf6b4ZQu EhFYn4BZoCFh8mBa1Kza7x9cgb4mzTYCE5dqaq041B/hRcp78fcakibuh93XiwwV50 ImXX2ARLDZk0VX4cAkZB71nLqN6yop+pNyx2GORQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390750AbfBKPEU (ORCPT ); Mon, 11 Feb 2019 10:04:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:53308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390751AbfBKPET (ORCPT ); Mon, 11 Feb 2019 10:04:19 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 C389D222AD; Mon, 11 Feb 2019 15:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897459; bh=cZGFX5Ht4a2et4aDTtyOA8yFoHMmEH30JKSY8aac+Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cIUWNkG4iAdPStMsX6T/vZyZEY9PZ1STkVa0sAZG0dY6nqzZqklfc427TQirkI1kl OBV6fwvwpJIBudcnyc9+jaGphDUi2VeuOHQ8yXEmHbSyAhuFIgj5CHpaAbbyFR1TI/ pp3cb29ABsNg4p9Irq2EWSqu20jLc1fI3DXwxvdc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Okash Khawaja , Samuel Thibault , Johan Hovold Subject: [PATCH 4.14 189/205] staging: speakup: fix tty-operation NULL derefs Date: Mon, 11 Feb 2019 15:19:47 +0100 Message-Id: <20190211141840.771814065@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit a1960e0f1639cb1f7a3d94521760fc73091f6640 upstream. 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 Reviewed-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_ttyio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -246,7 +246,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); } @@ -258,7 +259,8 @@ static void spk_ttyio_tiocmset(unsigned 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); }