video: tegra: nvmap: Do not export cvnas_dev

By exporting cvnas_dev all the internal data of the driver is getting
exposed to any driver that uses it. This could allow drivers to corrupt
this driver data. Hence do not export cvnas_dev, use helper functions to
get it's required member elements from nvmap.

Bug 200722684
Bug 3528414

Change-Id: I17f6fa1e98c777a7ec9118dbc6f0c6359e949f22
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2704698
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
Ketan Patil
2022-04-29 03:48:02 +00:00
committed by Laxman Dewangan
parent 3a87281353
commit 242600283f
2 changed files with 26 additions and 31 deletions

View File

@@ -80,10 +80,31 @@ static bool cvnas_rail;
#define HSM_CVSRAM_ECC_DED_MASK_0 0x80000000
#define HSM_CVSRAM_ECC_DED_MASK_1 0x00000007
struct cvnas_device *cvnas_dev;
#ifndef CVNAS_MODULE
EXPORT_SYMBOL(cvnas_dev);
#endif /* !CVNAS_MODULE */
struct cvnas_device {
struct dentry *debugfs_root;
void __iomem *cvsram_iobase;
void __iomem *cvreg_iobase;
void __iomem *hsm_iobase;
struct device dma_dev;
int nslices;
int slice_size;
phys_addr_t cvsram_base;
size_t cvsram_size;
struct clk *clk;
struct device_attribute *attr;
struct reset_control *rst;
struct reset_control *rst_fcm;
bool virt;
int (*pmops_busy)(void);
int (*pmops_idle)(void);
};
static struct platform_device *cvnas_plat_dev;
@@ -521,6 +542,7 @@ MODULE_DEVICE_TABLE(of, nvcvnas_of_ids);
static int nvcvnas_probe(struct platform_device *pdev)
{
struct cvnas_device *cvnas_dev;
int ret;
u32 cvsram_slice_data[2];
u32 cvsram_reg_data[4];

View File

@@ -21,33 +21,6 @@
#define __LINUX_CVNAS_H
#include <linux/types.h>
#include <linux/device.h>
struct cvnas_device {
struct dentry *debugfs_root;
void __iomem *cvsram_iobase;
void __iomem *cvreg_iobase;
void __iomem *hsm_iobase;
struct device dma_dev;
int nslices;
int slice_size;
phys_addr_t cvsram_base;
size_t cvsram_size;
struct clk *clk;
struct device_attribute *attr;
struct reset_control *rst;
struct reset_control *rst_fcm;
bool virt;
int (*pmops_busy)(void);
int (*pmops_idle)(void);
};
int nvcvnas_busy(void);
int nvcvnas_busy_no_rpm(void);