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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B46A7C433EF for ; Tue, 17 May 2022 11:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344941AbiEQLIX (ORCPT ); Tue, 17 May 2022 07:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344935AbiEQLIT (ORCPT ); Tue, 17 May 2022 07:08:19 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6AC217E2A; Tue, 17 May 2022 04:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652785689; x=1684321689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aZuMzyzE454rqEUy+oyhf8WPcSuEBUbU+ss/N1d+u/w=; b=IK0izjVVfEa9MyvgCh/aJu3va+xV5MvNN3Y7c1rCwruJRJ3Ym54LDLjs LQqrINVME4oPxzpzMkvB+A/WlELl1u2Wd7WVcHaPO+7GhcAsf4OtAxZ4O Oxr7xOOg3ioF9Z83+rEdpfsYRCvCg2jByLksfNgEX3KX2fvEnOoY/9Bhe PxBE5p/KM5F1nOVFJTUrKvIv3pXymJTL6Ooy+L+uGHHpJfiOKxRecD2mD Cy4DDiZKV3kXx9SIPlLMf+Zei6WuH3BRZ/SqQtmIypTJid2DxZYlbAUWy ZI/vf2k1sbGKEXp/Gz14XsBaaJuRyqLfuU2QQp/d/z05iTLajLaPDx2k7 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10349"; a="271268721" X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="271268721" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 04:08:09 -0700 X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="568831056" Received: from mtarral-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.52.88]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 04:08:07 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 4/9] serial: txx9: Don't allow CS5-6 Date: Tue, 17 May 2022 14:07:32 +0300 Message-Id: <20220517110737.37148-5-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220517110737.37148-1-ilpo.jarvinen@linux.intel.com> References: <20220517110737.37148-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Only CS7 and CS8 are supported but CSIZE is not sanitized with CS5 or CS6 to CS8. Set CSIZE correctly so that userspace knows the effective value. Incorrect CSIZE also results in miscalculation of the frame bits in tty_get_char_size() or in its predecessor where the roughly the same code is directly within uart_update_timeout(). Fixes: 1da177e4c3f4 (Linux-2.6.12-rc2) Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/serial_txx9.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 2213e6b841d3..228e380db080 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -618,6 +618,8 @@ serial_txx9_set_termios(struct uart_port *up, struct ktermios *termios, case CS6: /* not supported */ case CS8: cval |= TXX9_SILCR_UMODE_8BIT; + termios->c_cflag &= ~CSIZE; + termios->c_cflag |= CS8; break; } -- 2.30.2