From patchwork Mon Dec 5 18:35:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 9461327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 79E236071F for ; Mon, 5 Dec 2016 18:37:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67CC32094D for ; Mon, 5 Dec 2016 18:37:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C9C027BFC; Mon, 5 Dec 2016 18:37:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 400A22094D for ; Mon, 5 Dec 2016 18:37:41 +0000 (UTC) Received: from localhost ([::1]:43862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDy8x-0006ES-Qi for patchwork-qemu-devel@patchwork.kernel.org; Mon, 05 Dec 2016 13:37:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDy8c-0006EL-T8 for qemu-devel@nongnu.org; Mon, 05 Dec 2016 13:37:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDy8a-0007kV-BH for qemu-devel@nongnu.org; Mon, 05 Dec 2016 13:37:18 -0500 Received: from mail-by2nam01on0083.outbound.protection.outlook.com ([104.47.34.83]:20512 helo=NAM01-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cDy8Z-0007k7-Ty for qemu-devel@nongnu.org; Mon, 05 Dec 2016 13:37:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FtKBaEga0UMkMKmxG43Mg4brcmGVcNpFyrd/OWl8xE8=; b=D3npEa2/zThWhCp9jRCny7qZREi+3NAPTdYe8rUO04jwkT0AvY8pIPQ6MzlmDstsCUrNvtdoRcCaQTE4y0Z/s8Ut3dBJurp6feJbxkt/Uk8wc/ZzqltLcV9r49sDHfK239q1fwZCxKVuZJmQtzNn8CFxu3U7a9oPNmwgKtFjzuc= Received: from BN1PR02CA0032.namprd02.prod.outlook.com (10.141.56.32) by BN3PR02MB1143.namprd02.prod.outlook.com (10.162.168.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Mon, 5 Dec 2016 18:37:11 +0000 Received: from BL2NAM02FT007.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::200) by BN1PR02CA0032.outlook.office365.com (2a01:111:e400:2a::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Mon, 5 Dec 2016 18:37:11 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT007.mail.protection.outlook.com (10.152.77.46) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.761.6 via Frontend Transport; Mon, 5 Dec 2016 18:37:11 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1474; Count:15 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:52111 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1cDy8U-0000Q8-Mp; Mon, 05 Dec 2016 10:37:10 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1cDy8U-0006F2-JT; Mon, 05 Dec 2016 10:37:10 -0800 Received: from xsj-pvapsmtp01 (xsj-pvapsmtp01.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id uB5Ib4mK030768; Mon, 5 Dec 2016 10:37:04 -0800 Received: from [172.19.74.182] (helo=xsjalistai50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1cDy8O-0006CY-Lj; Mon, 05 Dec 2016 10:37:04 -0800 From: Alistair Francis To: , Date: Mon, 5 Dec 2016 10:35:26 -0800 Message-ID: X-Mailer: git-send-email 2.7.4 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22742.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-IncomingHeaderCount: 15 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(356003)(39450400002)(39410400001)(77096006)(106466001)(5660300001)(36756003)(39840400001)(39860400001)(39060400001)(38730400001)(48376002)(50466002)(50986999)(47776003)(7846002)(36386004)(33646002)(6666003)(5001770100001)(5003940100001)(305945005)(50226002)(626004)(8936002)(189998001)(8676002)(39850400001)(9786002)(118296001)(92566002)(4326007)(81166006)(81156014)(63266004)(2906002)(107986001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR02MB1143; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT007; 1:bzfntbExlGkGRCQf9HYvdNKR9YkdLWGXc0/J8FfMVVLq0s2EBscWoQGJAtQ68e3dWdEVXMmLJGsPh22Lkz+vLu36o7y3FsD/nZf1/iCIb7qOmMbOaEIEd2lUV078c7E8lgFb71yQNbAcrtmMXYJDTdf4k3BirJzDxaH7zZhFH91rLGQI3Hfv/LrvgariYwvyGbX7puukgcz6YJghyTawbSSaIujaowzvpGh8YF2wNzXnho4PbmUs6lwcTEMGTL8i9P8F/XOLx0eoCIXMy5VfF5HTbS19moWb4FISo6w8EuBW0t67lrstIBGYfcmbhmh25utQ1f0t8CmRUlW2G0GQa1NpW+BTy3tbgLeEQ7/2K3d+vz48Kc8ZAIXBXe3O1gIUC92RRei7nzNCIAbp+rjEWMh5pU1SWmIek518HUUq7BMRjwq2B1Vxe5y/ydrs0HTfrkND6XYSgKeq7WUsfJJ2ZV1huR5fJcTufNPZjT41YJyemWHMlDaR85upmbjQ2NBDXR91bQs7F2iUTAbnTixU4OakrsPfFhGaHUFZ6rpcOBQ3RdBohZgB2CyeAoKika1c2h0gGVg2yHofvkgrgeoi+u0WlW51Qed4eXjTL1W2uA/3nY4M7MspxOze4nlJ5qaH MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6daae1d1-3a6a-42cc-9344-08d41d3db9f7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:BN3PR02MB1143; X-Microsoft-Exchange-Diagnostics: 1; BN3PR02MB1143; 3:5QyHWVEFUV1/cl/ZNOBRswP8tBlDGPwflh1lMCKQwX7/jN0S2eMfZsf6UQW2kQXuU5/kVZbBgOPDRVvButpwORyF+uPJHKrgum34cqrXb+1gI6k5JEEjlBDNNNOlOiF67Yq/lkfMPPJlWJvlTOJt52XXBKkdTQ6Yk/BV3HKe8Vn+xWVkcdr7eHsA9XozrC/Of+PBAeImRzvJsKHSGhpQthu2PqOjRF/WKGVFNfyZltGhyAKcSO7iGttGM7V+zLPo6EFKhotZvLRu5Aan1VsVMCPi69x7niOMXKi9DXv8mVcdejbGcpaFKKKYKW+xgVxNqF8bCFZ4HPjCh8xsfFPsqU4u3HUlIEyAnZNRtgbX7T0xqrJvezTHOaxTFdkX/UMXdoxpwP78fGjrb22JFRv3kw==; 25:2adz5Gls8XRngQFesgqLyH8TE0JZgFq5Pbv9v1Fvh6oAyU9kKHx0PRN35adScEfttVrFfgvDBkxyV73zIu8RlNpIuguF9MMlKGX+i4N/lo4uWzzWevk1Cl+wsxNtAfaOwWmLTp8fP7496OddYPLT36qzN86Q/O2Yicp0FLtXXP0C8LPSNwJmrfh+4aszYRsxfmP3ICOI8UQUxIInP/gi6hVMqaUiTkFQtIAPgah0rYyrMSSEuobpn+6kkmbDk7lGMfSjX8ncuEfizbGAMcMPIORtFiFb8BKqzCs7Pa7r2uFwrLUJXVpd36seDpC5z5im9Kyu1nK9F5x5qKEIpCzM9Vmtaag2rQ+OMvOQyC+QXEUNdvcAzee+Mh/+qnLxqBvqOVchWyjwonm1bxZorktKb8qalw5Xf5pro0aGz1sbUHmeSEg6I8Nkn54cdXwtbhYCm1p0OGNdCI8/WltvQj8cBw== X-Microsoft-Exchange-Diagnostics: 1; BN3PR02MB1143; 31:Ix91BF5EWwmXBxBRMijBygVNzSNXib1mlWcmnhdSOuSi9nfOwKY7w+35JS3iPsA40valpo238aQdcohvJ5OTOvm0l0KYnt6Ugl/DsYKS04syKCSRHdFgoVlvTUOM4/a2nmrMI2Ri3TEDOXbspgLstYXbC4lh0ce50JOlFp5oou7N7P3fpuXdz12y504yTl0yo7BfK5CmwV5fcsMprubamNKqNKqmmlOglvmLVAtc0Rro20LlVJyMJqdEDZLNA3Nn3+NOendIFMwgRfmUL+XerPGAiPoAsZ5umQU4bl7Fvhs=; 20:T2w4jfeD+Gj0V+HEzLWJb9IbWp9UsVb4PZBU5ybbO4Vdae6pAp4nxIRjwAtaGFrhxvECgK6tygOta68jRft9cf8mBhhTPSheV29JRSI+ZTaVEwKw40a3DkpnVCdMIs19Eja56A2px2rhbfovV1Rc0UwzYMncxWVx+CWhN/xIYl7vybFtcnr3ucKEeC/TxHhyAJ9BTjUww+YUNCmqP214mgJAJ/g12VTlC0nhirJno1azl6KEe1QL9E7XBHhf34a+/pWZCpZtZbwABX9ZNQcBsVypkoUzimepQj6IHSblVxc8M/5c8mP23FltfinQ9IF1+HdJf9fEPVuehcPlxdROJz6qXWga/yKf7Ds+gnqg1dIH0Maxmg8ZW1NrZfXapVaW6lT71hJx7SjbLHmW9H8TwRMkCngOs/+YbVzVbWki2v2NGYNP+XL2imliqVUNgRjbCWDQorM7IQLhYnlLMlyPuIraneJAHGctgW9/WNg0Celq/dIcz+T3j2qUz1siwrOy X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(50582790962513)(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13023025)(13024025)(13015025)(13017025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:BN3PR02MB1143; BCL:0; PCL:0; RULEID:; SRVR:BN3PR02MB1143; X-Microsoft-Exchange-Diagnostics: 1; BN3PR02MB1143; 4:y7YxWC5WoQFDb+yIYNwjNL8n5udkxBN/NQDU5HKd33GrCT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VDKgun8l6nhPla1mFjR3O8+ZIziIpPE2vG3G9Is4CJissjjDV63rPe/mgrt4v9+E11xwLHuyPXvqrIEYtJiwBmZTqj6RugGbkha2EOnhxFrfJFdgKGEeuQZ7JqS1IeR5xcmxM3kn6sBJgX8k9viMGUJ+BM4ble79KFvxP9W1Qcx3dHJ3C7JdC/B9HA3Bf/u9jDcWtWtoIkoXsZCoMrC8Z+UqaUzxNNwvHIx2PkHp6+l2dNF40a3aku9PiGWGiITJNUE2Q3LCS/qLhRnq/TilFCi2zbO5mSKvfHsnW8PbQnR9JQzt46N1gF3kdgk3lilaH8rXGDdP2mjruLVVbm98zZzpim9UYVw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2016 18:37:11.4115 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR02MB1143 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.83 Subject: [Qemu-devel] [PATCH for 2.8 v3 1/1] cadence_uart: Check baud rate generator and divider values on migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, psirt@huawei.com, pjp@fedoraproject.org, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The Cadence UART device emulator calculates speed by dividing the baud rate by a 'baud rate generator' & 'baud rate divider' value. The device specification defines these register values to be non-zero and within certain limits. Checks were recently added when writing to these registers but not when restoring from migration. This patch adds checks when restoring from migration to avoid divide by zero errors. Reported-by: Huawei PSIRT Signed-off-by: Alistair Francis --- It would be nice to squeeze this into 2.8 if possible. V3: - Fix broken migration logic - Manually double checked and it passes migration. V2: - Abort the migration if the data is invalid hw/char/cadence_uart.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index 0215d65..ce9063b 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -502,6 +502,13 @@ static int cadence_uart_post_load(void *opaque, int version_id) { CadenceUARTState *s = opaque; + /* Ensure these two aren't invalid numbers */ + if (s->r[R_BRGR] <= 1 || s->r[R_BRGR] & ~0xFFFF || + s->r[R_BDIV] <= 3 || s->r[R_BDIV] & ~0xFF) { + /* Value is invalid, abort */ + return 1; + } + uart_parameters_setup(s); uart_update_status(s); return 0;