Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2713566imj; Mon, 11 Feb 2019 07:23:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IZru6bF8akcM/IRFpQcOfUEalY0iNVKejoLlI2IrcPi4cXJhV1tY0WBx7QowpUHBPR/LiaR X-Received: by 2002:a17:902:1:: with SMTP id 1mr36206900pla.276.1549898585170; Mon, 11 Feb 2019 07:23:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898585; cv=none; d=google.com; s=arc-20160816; b=UeKroJ6iXDJp+rBMRF9z0xx/ZMHAr38neBnd54EMcmOsPO+yZnbGhDut2tpUnHRt/+ K98cy9hjXOWBS5F318DB+zJERLLc19VVSLpA1NQeA31doW52NXK3PhtFmv+DMqvYkJtq Rm+hxkIIZBeKf0kdK6rSibHfdCZxSge0eV05yhkMEUV/88qUrVhKbhEWLcbAF4SSTLY9 SDYfAkX+AQNBsSdZq2oN4MlwWsYnkufRVQ1tmhdo30VcbwrtYQgY4Q6Pfw5IIEtfHyQc hkzg2g7FCxzSTKQiZw9xc8zR3ByUvM8qdTeIgu52fu9HEzinkqflnlLRNtq6CfmIfura 31Sg== 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=+C3JCuGDrxN7Qfk/WvajaM5fdsFdQpmzvv4VO1nk7sQ=; b=BvAEdZsKe09JXV9qwwnIZLshhoKkOK4oXYLpMdpAy7UCR3EKOLIfK/NdxSHnrZTXbm aR5PfKanCTjCX/WqReX+m1FFsK5sk6I/NSW8i8HbVDnCpwNkBJk08VZvU8XhEc8594DS B0EwZtU9nYpi6d+ZlbF3IdOSYP+IvKF69mfhzWGvlCfBvw7y9ZXdzkkEnC21ArrJfl7r VpiCTjfqvtcMcWnYn1JmAZ8ijnDNK6pjx1j4UHG6OHnrChEhskYaWl/dMgg8u2nr1RxH xzZRic2VcReIRgp2hxyIiAC1MIFLyPx06Csoq157k0Gk7lfKcbfXYx5Gx4HHQYW0Hbs+ Dvyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cIUWNkG4; 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 g11si10341555pgn.32.2019.02.11.07.22.42; Mon, 11 Feb 2019 07:23:05 -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; dkim=pass header.i=@kernel.org header.s=default header.b=cIUWNkG4; 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 S2390765AbfBKPEY (ORCPT + 99 others); Mon, 11 Feb 2019 10:04:24 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); }