mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
nvadsp: adspff: Fix kernel crash if file not found
Check file->fp for NULL before returning the file handle to ADSP in adspff_fopen, which otherwise results in a kernel crash on successive file operations using the same file handle if the requested file does not exist. Jira: EMA-1152 Change-Id: I307cc82dd3a2135039b819d1f746ee8164568110 Signed-off-by: Niranjan Dighe <ndighe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1929809 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Uday Gupta <udayg@nvidia.com> Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com> Reviewed-by: Nitin Pai <npai@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
e23ed464ef
commit
989d49990e
@@ -11,6 +11,8 @@
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "adspff: " fmt
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <asm/segment.h>
|
||||
#include <asm/uaccess.h>
|
||||
@@ -175,6 +177,13 @@ void adspff_fopen(struct work_struct *work)
|
||||
file->wr_offset = 0;
|
||||
file->rd_offset = 0;
|
||||
|
||||
if (!(file->fp)) {
|
||||
kfree(file);
|
||||
file = NULL;
|
||||
pr_err("File not found - %s\n",
|
||||
(const char *) message->msg.payload.fopen_msg.fname);
|
||||
}
|
||||
|
||||
msg_recv->msgq_msg.size = MSGQ_MSG_SIZE(struct fopen_recv_msg_t);
|
||||
msg_recv->msg.payload.fopen_recv_msg.file = (int64_t)file;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user