Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2661329imj; Mon, 11 Feb 2019 06:38:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IZAeO2dHhJsVbikc1OS/pvH/kH9k11Q3ryYOBoUdxhcxSo3sZUiuUzWiXFJE0YYFvoKq48g X-Received: by 2002:a62:41cc:: with SMTP id g73mr12148269pfd.145.1549895898227; Mon, 11 Feb 2019 06:38:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895898; cv=none; d=google.com; s=arc-20160816; b=TN2H8upYNVaFaLxG/irpbfcLwTNR5wYRYYlPYqRziangdv93b9yo4RC3RLXEpMHybC GcpFTTsrYmZBebEuA0l9v7hiJSHJs6t9GAVxz2iNjILnfy+ISJOvV2O1WMqlzyA+AbbE mI9FVW/AXRIUwoE5i+1jn1h8Z8swlSBFQg1bje43XtQ99H7rEQT+0JhELZFLK0nrOisR JrW3QZtzaZDBlCA6IHVA8dCUV5e3P504nWeSTnYiqGw+SQV1Nhgg+ubXE0av7spNjHQL FiHrDwTEXnqzQ3mkqPx1p+6M54WFKsv6gdsXfmigLg++QIgqUCm4t/e+9yK4km42WR6a to8w== 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=F/gf4cSE2w6qCB7FWU5EJIVAHYNYV5OthFigAniz1ZU=; b=N16EV1pjeHWLVZq5TKiTojv6wofanh/15V4X8cinxuMz2sV4YkskU4nOVyqHWuyj2n hduA0GoGgyUmjBdwdoqwnx162fK581HyEMXqeuFoyUmQAacRommXvIKmCVbf5C0b916S ZCfQRQJizFVMHStJ7yiEH5FwHGSOu13/gRehwPTjqxsP6ppZW27+Qv/qlwUg7KZTDBFv J7L9wDcZhiyXa6+YoHolug8HJjG3oFRTUoXAhvGMRpp5PeEkFhWapYKTG4qGGx8WfIii WMuQ6iYLRpBuHvmZnoG8NTZWtV63WRROeYZ9+F3qwPOYCodDuL86CrKdWp5FufQPHiCl YQiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wdQwIVZU; 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 v3si9811444pgh.305.2019.02.11.06.38.02; Mon, 11 Feb 2019 06:38:18 -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=wdQwIVZU; 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 S1729030AbfBKOhM (ORCPT + 99 others); Mon, 11 Feb 2019 09:37:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:46442 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731393AbfBKOhJ (ORCPT ); Mon, 11 Feb 2019 09:37:09 -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 E41D720844; Mon, 11 Feb 2019 14:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895828; bh=q1OdszwJa/2UkE+YbLygIPqEgEoN4H82mQWtPP0SXMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wdQwIVZU8tWCb7tGXMP+Co8Z8nhVZNVuIn3iY1UhGTx5Vq+6fVOhKGBrthhGcqZwf HE5GjXFg3H/mEzlyWfhHTVMnXMQL5W4VP00cAF6P4jxaLwtdMZfXZM7AhrP7m5kcH5 3fCn8M3j4YKiLhSdL4//u2RvvHtrTgNznRJw+nQI= 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.20 335/352] staging: speakup: fix tty-operation NULL derefs Date: Mon, 11 Feb 2019 15:19:22 +0100 Message-Id: <20190211141908.392171881@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 @@ -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 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); }