From patchwork Tue May 17 11:07:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 573640 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 BECF5C433F5 for ; Tue, 17 May 2022 11:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345043AbiEQLJg (ORCPT ); Tue, 17 May 2022 07:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344985AbiEQLIg (ORCPT ); Tue, 17 May 2022 07:08:36 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309D62DABA; Tue, 17 May 2022 04:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652785711; x=1684321711; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nQ+lnY6dYx8GIiIqMS+NqyRc9HSpuylhm5ub7+G+Sro=; b=CxWEBRFnwuGMk//GWb0esBq7Gonnjr/PxnOHH4jgL/UiIp4j4MzYtary H0Kmf6zL94RFjpTkHE0eZCzt2RdZPY5K6pTtfwIpocXedbpKTrzoHfOuJ n8xbua6TAmVgsqQZ76K8TZdxHO3hLJdfsOnBTQoWv6YlZPgNW0Tk3XVDZ 7QBnZzx5xzkvRBQyi83tXVbNoNbuL5Uk0UDhylAN4MuNXu5kZxu7idmWC YNF0UihJf1HSXHnVN2GqV9c/xoaQcifWCw4mmi34srIh36h/fpxDwx5WR WeoyB4HmkDzOMN8AckHkgL67VvbVJVoxKECUV0uh1yLOBBrZF93V8bu6O Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10349"; a="271268802" X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="271268802" 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:30 -0700 X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="568831154" 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:26 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Arnd Bergmann , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 9/9] pcmcia: synclink_cs: Don't allow CS5-6 Date: Tue, 17 May 2022 14:07:37 +0300 Message-Id: <20220517110737.37148-10-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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Only CS7 and CS8 seem supported but CSIZE was not sanitized in termios c_cflag. The driver sets 7 bits whenever data_bits is not 8 so default to CS7 when CSIZE is not CS8. Signed-off-by: Ilpo Järvinen --- drivers/char/pcmcia/synclink_cs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 78baba55a8b5..d0572bbe8832 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -1418,7 +1418,11 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); /* byte size and parity */ - + if ((cflag & CSIZE) != CS8) { + cflag &= ~CSIZE; + cflag |= CS7; + tty->termios.c_cflag = cflag; + } info->params.data_bits = tty_get_char_size(cflag); if (cflag & CSTOPB)