From patchwork Wed Jun 5 17:06:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Dingchen (David)" X-Patchwork-Id: 10977363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36BCC92A for ; Wed, 5 Jun 2019 17:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 136FF28968 for ; Wed, 5 Jun 2019 17:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07AEC28A72; Wed, 5 Jun 2019 17:11:36 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7E10B28968 for ; Wed, 5 Jun 2019 17:11:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2100F89220; Wed, 5 Jun 2019 17:11:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680080.outbound.protection.outlook.com [40.107.68.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FF2F89220 for ; Wed, 5 Jun 2019 17:11:32 +0000 (UTC) Received: from SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) by DM5PR1201MB0060.namprd12.prod.outlook.com (2603:10b6:4:51::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1943.17; Wed, 5 Jun 2019 17:11:30 +0000 Received: from BY2NAM03FT025.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::209) by SN1PR12CA0046.outlook.office365.com (2603:10b6:802:20::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1965.13 via Frontend Transport; Wed, 5 Jun 2019 17:11:30 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT025.mail.protection.outlook.com (10.152.84.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1965.12 via Frontend Transport; Wed, 5 Jun 2019 17:11:30 +0000 Received: from Jiraiya.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 5 Jun 2019 12:11:28 -0500 From: Dingchen Zhang To: Subject: [PATCH 1/2] drm: not to read outside the boundary for CRC source name. Date: Wed, 5 Jun 2019 13:06:38 -0400 Message-ID: <20190605170639.8368-1-dingchen.zhang@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(39860400002)(346002)(376002)(396003)(2980300002)(428003)(199004)(189003)(6666004)(305945005)(6916009)(53936002)(356004)(36756003)(2906002)(476003)(8676002)(426003)(53416004)(486006)(126002)(336012)(50466002)(86362001)(51416003)(72206003)(44832011)(2616005)(478600001)(16586007)(26005)(14444005)(77096007)(81156014)(47776003)(70586007)(8936002)(50226002)(81166006)(2351001)(1076003)(316002)(48376002)(186003)(4744005)(68736007)(5660300002)(7696005)(70206006)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0060; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdd12422-215c-4951-fecd-08d6e9d8da3e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:DM5PR1201MB0060; X-MS-TrafficTypeDiagnostic: DM5PR1201MB0060: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:873; X-Forefront-PRVS: 00594E8DBA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: rl9jxcSYovdfiq5/Zkypnd8jSJnRLSBleweTFEsyLhMvWswcrRxHTpZL0zrZpuroERG2l1XmZ/fwtoD2llgwdZWk7aF9Ny6+SEI+zQwltHja4KhkwEMpoL2NxZnjO4/xHTA0SBUPuNn/Qobe/WLkErLjnCetLmht2L6RUJxhnMAqhtGAmQgbLxuSg/DAfm/K/0Ng73fyN85nhonu4LDQB7Dym0EM4wX33w34jleaZdniWwyxkkixB4yRyUdBTn3Jmt4iYkRADJffH9s6oD+EaAVWUFWPkG8GGeuNk1Qveegfyp8sCywsZPzzXWkpvQ8XeRULwepysAkC6MfWqjCu0dbN6Wn+yWEpHW+yVAPVpw7suhr2UjBtxZ/MTvzFewcuNIAOfcvfUKKULDyyL0y6y+KgeO27tTZWZzrwaWqb5aI= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2019 17:11:30.1721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdd12422-215c-4951-fecd-08d6e9d8da3e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0060 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p8h9fAHwlwpsVoSRZdygc2zwn7BwHcoaFEl5C6WmeBM=; b=HD2a3TJO3Nja2cZMbK8bUX5wUhnpub6nm0RZcGkhv+RfvoR5pKKYB2ejikBmueVGWxWw8iLDmGqYn++ddeeMGmQDb2Hvo04Zx3RXQV+6hqOTG0iEGSyKJt7IBnWUXesVGBWO0IzU448DwP8kGJ7ynR9mGwQxI4rWR93/Aily/UI= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dingchen Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 'n-1' is the index to access the last character of CRC source name. Cc:Leo Li , Harry Wentland Signed-off-by: Dingchen Zhang --- drivers/gpu/drm/drm_debugfs_crc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 585169f0dcc5..e20adef9d623 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -131,8 +131,8 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf, if (IS_ERR(source)) return PTR_ERR(source); - if (source[len] == '\n') - source[len] = '\0'; + if (source[len-1] == '\n') + source[len-1] = '\0'; ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt); if (ret) From patchwork Wed Jun 5 17:06:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Dingchen (David)" X-Patchwork-Id: 10977367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07CE315E6 for ; Wed, 5 Jun 2019 17:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E168828A01 for ; Wed, 5 Jun 2019 17:11:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D624E28A5D; Wed, 5 Jun 2019 17:11:57 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9282828A70 for ; Wed, 5 Jun 2019 17:11:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7B40892CD; Wed, 5 Jun 2019 17:11:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740089.outbound.protection.outlook.com [40.107.74.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99CE08922E for ; Wed, 5 Jun 2019 17:11:54 +0000 (UTC) Received: from DM6PR12CA0023.namprd12.prod.outlook.com (2603:10b6:5:1c0::36) by BN7PR12MB2658.namprd12.prod.outlook.com (2603:10b6:408:29::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1943.22; Wed, 5 Jun 2019 17:11:52 +0000 Received: from BY2NAM03FT017.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::207) by DM6PR12CA0023.outlook.office365.com (2603:10b6:5:1c0::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1943.22 via Frontend Transport; Wed, 5 Jun 2019 17:11:52 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT017.mail.protection.outlook.com (10.152.84.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1965.12 via Frontend Transport; Wed, 5 Jun 2019 17:11:51 +0000 Received: from Jiraiya.amd.com (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Wed, 5 Jun 2019 12:11:51 -0500 From: Dingchen Zhang To: Subject: [PATCH 2/2] drm: Set crc->opened = false before setting crc source to NULL. Date: Wed, 5 Jun 2019 13:06:39 -0400 Message-ID: <20190605170639.8368-2-dingchen.zhang@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190605170639.8368-1-dingchen.zhang@amd.com> References: <20190605170639.8368-1-dingchen.zhang@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(396003)(346002)(39860400002)(376002)(2980300002)(428003)(189003)(199004)(2906002)(1076003)(77096007)(4744005)(426003)(336012)(11346002)(44832011)(486006)(186003)(356004)(6666004)(2351001)(51416003)(7696005)(26005)(70206006)(16586007)(4326008)(36756003)(70586007)(68736007)(53936002)(6916009)(446003)(126002)(305945005)(47776003)(316002)(476003)(14444005)(2616005)(50466002)(53416004)(86362001)(48376002)(81166006)(81156014)(8676002)(8936002)(478600001)(50226002)(76176011)(5660300002)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR12MB2658; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27fd16c1-2d9b-41cc-76f6-08d6e9d8e73d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BN7PR12MB2658; X-MS-TrafficTypeDiagnostic: BN7PR12MB2658: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 00594E8DBA X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: b7g5q+oMksbE3yOHuq5dquoXOrNTMbUU0SPKc6VO8yXydMHyDzeN2qAyAZU43lnjaQIWdJbo/bq1XSCrZNMW2M3V76LemX6Sa0MClfvQQAE3nmSmxBeeVeR/RBR3LibrocYG4021T5OdSc81gVD6aOIemyYjh4dSAnddgr5BuOE90LWu6fTHdKtEjnOnlBxNuSGPGpWluhdnENs8v7BPBVnYg/o25MeVc2Hk4pRxjF8ty+sXLSj5tr5AfuYJbn1VXNjTsG2BmU3jJe2l2OnpwrlLlQhBDT0xXeGwKjguljKUIoCSes5uHjOz03mC4FKTi0YWtIPbC/QeN4cAYZI7aQ5u67AG30PTaLkSnUKf17K1xYjEFe+OO2ujQK3yOvFNsCr74lp0cetP+Txy634Yxh6yfgH86wjpWs7NRWQ9hps= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2019 17:11:51.9765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27fd16c1-2d9b-41cc-76f6-08d6e9d8e73d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2658 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ank6LjURYOTzj/L52ts4tx5sEgwzEI2x29HXro7EiNM=; b=IaBRMdLhp+BSr9jtTX0svyI3Ke1Kuj9FZBD16NG3mr8l5aUFEjzZbSmeN1cFjr1U4oWdU3LGAV9hMng6rrWLYXGF3y8E8DWFKTRxHvvq/dOJg98iPyYrwPqpkR2l95cFpRy74hEP+lX2luO6Mnk1djb0V+CudImthM4iGfYa7v0= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dingchen Zhang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP to terminate the while-loop in drm_dp_aux_crc_work when drm_dp_start/stop_crc are called in the hook to set crc source. Cc:Leo Li , Harry , Nick Signed-off-by: Dingchen Zhang Reviewed-by: Harry Wentland Reviewed-by: Nicholas Kazlauskas --- drivers/gpu/drm/drm_debugfs_crc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index e20adef9d623..0e8bcc130383 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -249,6 +249,13 @@ static int crtc_crc_release(struct inode *inode, struct file *filep) struct drm_crtc *crtc = filep->f_inode->i_private; struct drm_crtc_crc *crc = &crtc->crc; + /* terminate the infinite while loop if 'drm_dp_aux_crc_work' running */ + if (crc->opened) { + spin_lock_irq(&crc->lock); + crc->opened = false; + spin_unlock_irq(&crc->lock); + } + crtc->funcs->set_crc_source(crtc, NULL); spin_lock_irq(&crc->lock);