Commit 44524821 authored by Carrie.Cai's avatar Carrie.Cai
Browse files

fix 0 day bugs for Mont-TSSE Driver

Montage inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9BEHG


CVE: NA

----------------------------------------------------------

Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes:https://lore.kernel.org/oe-kbuild-all/202403230839.j7ODqH5Y-lkp@intel.com



Signed-off-by: default avatarCarrie.Cai <carrie.cai@montage-tech.com>
parent 1bf66e08
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -115,7 +115,8 @@ static int tsse_sriov_configure(struct pci_dev *pdev, int num_vfs_param)
}

/**
 * This function will be called when user writes string to /sys/bus/pci/devices/.../tsse_image_load.
 * tsse_image_load_store() - This function will be called when user
 * writes string to /sys/bus/pci/devices/.../tsse_image_load.
 * Driver will always loads /lib/firmware/tsse_firmware.bin.
 * @dev: device
 * @attr: device attribute
+5 −4
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ static int fw_send_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
}

/**
 * Get version information from firmware
 * get_firmware_version() - Get version information from firmware
 * @fw: firmware pointer
 * @fw_version_out: firmware version string output
 * Return: 0 on success, error code otherwise
@@ -103,9 +103,10 @@ int get_firmware_version(const struct firmware *fw, char *fw_version_out)
}

/**
 * Firmware service to handle IPC message from mainCPU.
 * fw_service() - Firmware service to handle IPC message from mainCPU.
 * It will write init or manual load firmware to PCIe BAR and send message back.
 * No return value.
 * @tsseipc_t: pointer to a structure used for IPC
 * @msg_t: pointer to IPC message
*/
void fw_service(void *tsseipc_t, void *msg_t)
{
@@ -152,7 +153,7 @@ void fw_service(void *tsseipc_t, void *msg_t)
}

/**
 * Load firmware from /lib/firmware
 * tsse_fw_load() - Load firmware from /lib/firmware
 * @pdev: pci device
 * @name: firmware file name
 * @fw: pointer to firmware pointer
+6 −3
Original line number Diff line number Diff line
@@ -15,8 +15,10 @@
#include "tsse_service.h"

/**
 * Create ipc_msg and read message from BAR.
 * get_msginf() - Create ipc_msg and read message from BAR.
 * Return the pointer to ipc_msg, the caller is responsible for free it.
 * @d2h: device2host memory pointer
 * Return: new ipc_msg pointer, which points to message read from device
*/
static struct ipc_msg *get_msginf(void __iomem *d2h)
{
@@ -80,8 +82,9 @@ void notify_device(struct tsse_ipc *tsseipc)
}

/**
 * Enable main2host interrupt, cleanup interrupt set value in host2main and main2host.
 * No return value.
 * ipc_hw_init()- Enable main2host interrupt, cleanup interrupt
 * set value in host2main and main2host.
 * @hw_ipc: pointer to a structure used for IPC
*/
static void ipc_hw_init(struct tsse_ipc *hw_ipc)
{