Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1238061rwb; Thu, 10 Nov 2022 13:13:28 -0800 (PST) X-Google-Smtp-Source: AMsMyM7Qhx+LsyzlFZaArLCODI1faSmJm2k9O6Y6GLFwpqykzG4IXTrNjHp3ydkGIKc1j1PcCpq+ X-Received: by 2002:a17:90a:d344:b0:213:95f:d37b with SMTP id i4-20020a17090ad34400b00213095fd37bmr2030741pjx.60.1668114807812; Thu, 10 Nov 2022 13:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668114807; cv=none; d=google.com; s=arc-20160816; b=VPyD7ZenfZmV9WWGtrSiR/XierH8Vi1Ep33UmP3OkR+rawu6qg8C0Vb+dCkeEphJas rmSccmMJdrPBQiSf18QYMA/izmnxl5bFeLeejU4O2660VYqBGuWVQNVM4aCYcOcs2PSe k3I7WGpHAjtMejknV1vnufi/ESJABYHWvBofUmlPLYk5+e0wnk/zi0Cs4dTlpmTHTyez p1/kQ/4bJPLfvGmivaWuPrHCdp0YKWOe5sT3f7aYiBBAKZn8Q5yVKtBezIHtl7N+v7eo HD2I/lnkmgDbsy9SBIYMwWInIADTu/x9GEwwh8d11+ZPENRLgIlT8+X5Xyrlavx/p4d2 gS2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kEi0e3L8+2KPLk86MHEQEVD60tWun2s11MndgHtUsQQ=; b=KMdfUCTB/WAP4TJBgUjlig2lY8n0GfOD1yDkNNu9IGhQpTyCk2QxnIZX/rAZwaT6Xh NWphah0U06uauSp8Ip1QXPMqIUGmnJDqpsemWpd8Oe9MoTYlXqNMyAqkfxDUjDSKedxt wuHT/ZCqgkLKY/5qOB4GNk4OzcAK/ywTeCqr2/w1jpU9VmqqFn75zkO74VQBN04jz7yv /kCFOB/9N0RxCGdF5vasmbiZ3eq488cgt6MX7pzDZiHXhFHFe7YuEgwaxopqCkwxJRCf NovsY1murIqQnaS+fxuqYHGM1DqiQ2tgk3jKM+gq9D19PunqWZVmesdGu+X3VDdMaN0s dU7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Vs2Dxqer; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a63214e000000b004606d9040b9si213238pgm.649.2022.11.10.13.13.15; Thu, 10 Nov 2022 13:13:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Vs2Dxqer; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbiKJUO4 (ORCPT + 92 others); Thu, 10 Nov 2022 15:14:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbiKJUOx (ORCPT ); Thu, 10 Nov 2022 15:14:53 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90B644D5E6; Thu, 10 Nov 2022 12:14:52 -0800 (PST) Received: from dimapc.. (unknown [109.252.117.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 32EF16602A35; Thu, 10 Nov 2022 20:14:49 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1668111291; bh=8lPPkB/X/nAF7UCnlj4YAfVJ4CiTG60x/dmXzJUkhFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vs2DxqerXBoYuKVokuo4qllebuVOqRgJgOpEfACXfRig5MufY62WKEHWvF/TUVx5J cLnzg7+wdeX5IipFW0IcfkQN1byMmwbt/0wlM/oGvFJEMvmAHO0WeOnQJltTIjkON9 OT56X85voHyfhssNDFiy7CAvhnjlcF+LZ0YBuOQedrYMIix/hsfgyRYJ2FaHYo2NhF eD9Qz6L32qGZXVhlY3HuwfdxozObHRKC0FCIAbvyLZVmNXmqBJ5svUDWy5tgC8fHq8 OY6cY1et+6vAWLYfCRoEJ0vs5iiKlfkc9eCn+24UrhclhzmzECbfJJlC/lvPZkrEvd GOgUuvv+yCMjg== From: Dmitry Osipenko To: Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Benjamin Gaignard , Liam Mark , Brian Starkey , John Stultz , Gerd Hoffmann , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Thomas Zimmermann , Tomi Valkeinen , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , Srinivas Kandagatla , Amol Maheshwari Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 1/6] dma-buf: Move dma_buf_mmap_internal() to dynamic locking specification Date: Thu, 10 Nov 2022 23:13:44 +0300 Message-Id: <20221110201349.351294-2-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221110201349.351294-1-dmitry.osipenko@collabora.com> References: <20221110201349.351294-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All dma-buf functions has been moved to dynamic locking specification The dma_buf_mmap_internal() was missed out by accident. Take reservation lock around file mapping operation to adhere the common locking convention. Reported-by: Daniel Vetter Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/dma-buf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 13bfd2d09c56..b809513b03fe 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -129,6 +129,7 @@ static struct file_system_type dma_buf_fs_type = { static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) { struct dma_buf *dmabuf; + int ret; if (!is_dma_buf_file(file)) return -EINVAL; @@ -144,7 +145,11 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) dmabuf->size >> PAGE_SHIFT) return -EINVAL; - return dmabuf->ops->mmap(dmabuf, vma); + dma_resv_lock(dmabuf->resv, NULL); + ret = dmabuf->ops->mmap(dmabuf, vma); + dma_resv_unlock(dmabuf->resv); + + return ret; } static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence) -- 2.37.3