Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6383639imu; Sun, 2 Dec 2018 16:56:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/XoD3f0rV1oZRyKLG9UN0kPpyIPaj8DNFF1iyIzZBWh/vUh45vtAKa+/3vG0mszoE1hyweU X-Received: by 2002:a62:938f:: with SMTP id r15mr13869970pfk.27.1543798601225; Sun, 02 Dec 2018 16:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543798601; cv=none; d=google.com; s=arc-20160816; b=JO/w9YOjYdPB/ttIw4f3JGF3/o196vlnaqLqcT1jPdeHwBSgohusgQu/hzT3UmiuNp +n6PlpKVigPJ7IbtXF5I2nWsKppFnz7HtAnR2yz5I6CzVPCt3qh6gcxe2ZCeFGB1McWi lemOQvNQ5T8EKJlrAVP5YOuDIUdYa145Su+Fy4v/XBsnQrhRCDxDUeC47FV0bRI2dANN 4VTuZk2puJ4k9qjXLnLUL5pN4KsHZ85l4gKBch8rvPLf4+X4BvxDp/52Yr9anP3iA8jG 1WKikimJ96sMzcj3FUznFITuA8NkduCrlnp9l3kwNkYg6uZpU7tSRGo/zb8QJatFgHaN tvuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:to:from; bh=krU9O6Ua3pGGSuT5J6EUVd7uAwr72ZFdbk46bBgnW6M=; b=K6ui2FQkRAZ/0QudI52L28OLI9cOZbuEDp7SYrLf3htaYtnK473T2f/6hZ92hrvP0H 2kdbXVu+6EQPUOkA92V3fTP4bXUgGDBJ9ryVNjZVdqmFvxNt1NUA0RqhTlK+P+BZCfPO qdH4ps64d9hEWgYwCcl/Fw8PoSG/PY8ycNzCYcQ7snZeX7Uvf2ly003h7y/WfqY7jB4d AkVUseOVaB0iNz42lgr6/Kk9HMxYBTqi4STP3IPPJXVXiEf5OScBQuU3D7nDEa+qZsZm 6yAfcSXZtKFE9I3KqYqrS0mUEU4J/WSddSu0/R/SNGLMn8hU0hsjG89abR6JlpiHjWCx Lq+w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b128si12529446pfa.283.2018.12.02.16.56.26; Sun, 02 Dec 2018 16:56:41 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725897AbeLCAxe (ORCPT + 99 others); Sun, 2 Dec 2018 19:53:34 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39776 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725790AbeLCAxe (ORCPT ); Sun, 2 Dec 2018 19:53:34 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB30memx022828 for ; Sun, 2 Dec 2018 19:53:29 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p4snf9bbs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 02 Dec 2018 19:53:28 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Dec 2018 00:53:27 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 3 Dec 2018 00:53:25 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wB30rOv264749626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 3 Dec 2018 00:53:24 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E04AAE04D; Mon, 3 Dec 2018 00:53:24 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEB7FAE045; Mon, 3 Dec 2018 00:53:23 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 3 Dec 2018 00:53:23 +0000 (GMT) Received: from tungsten.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 1D0FCA0231; Mon, 3 Dec 2018 11:53:22 +1100 (AEDT) From: Sam Bobroff To: daniel@ffwll.ch, airlied@redhat.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] drm/ast: Fix incorrect free on ioregs Date: Mon, 3 Dec 2018 11:53:20 +1100 X-Mailer: git-send-email 2.19.0.2.gcad72f5712 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18120300-0008-0000-0000-0000029BE304 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18120300-0009-0000-0000-000022063935 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-02_16:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=850 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812030007 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the platform has no IO space, ioregs is placed next to the already allocated regs. In this case, it should not be separately freed. This prevents a kernel warning from __vunmap "Trying to vfree() nonexistent vm area" when unloading the driver. Fixes: 0dd68309b9c5 ("drm/ast: Try to use MMIO registers when PIO isn't supported") Signed-off-by: Sam Bobroff --- drivers/gpu/drm/ast/ast_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index dac355812adc..373700c05a00 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -583,7 +583,8 @@ void ast_driver_unload(struct drm_device *dev) drm_mode_config_cleanup(dev); ast_mm_fini(ast); - pci_iounmap(dev->pdev, ast->ioregs); + if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET) + pci_iounmap(dev->pdev, ast->ioregs); pci_iounmap(dev->pdev, ast->regs); kfree(ast); } -- 2.19.0.2.gcad72f5712