Patch "tools/hv: Add memory allocation check in hv_fcopy_start" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tools/hv: Add memory allocation check in hv_fcopy_start

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tools-hv-add-memory-allocation-check-in-hv_fcopy_sta.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2bcbd25b52f61aaf240438243ca56e7f9fda35a0
Author: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
Date:   Fri Sep 6 02:13:33 2024 -0700

    tools/hv: Add memory allocation check in hv_fcopy_start
    
    [ Upstream commit 94e86b174d103d941b4afc4f016af8af9e5352fa ]
    
    Added error handling for memory allocation failures
    of file_name and path_name.
    
    Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
    Tested-by: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240906091333.11419-1-zhujun2@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
    Message-ID: <20240906091333.11419-1-zhujun2@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/hv/hv_fcopy_uio_daemon.c b/tools/hv/hv_fcopy_uio_daemon.c
index 3ce316cc9f970..7a00f3066a980 100644
--- a/tools/hv/hv_fcopy_uio_daemon.c
+++ b/tools/hv/hv_fcopy_uio_daemon.c
@@ -296,6 +296,13 @@ static int hv_fcopy_start(struct hv_start_fcopy *smsg_in)
 	file_name = (char *)malloc(file_size * sizeof(char));
 	path_name = (char *)malloc(path_size * sizeof(char));
 
+	if (!file_name || !path_name) {
+		free(file_name);
+		free(path_name);
+		syslog(LOG_ERR, "Can't allocate memory for file name and/or path name");
+		return HV_E_FAIL;
+	}
+
 	wcstoutf8(file_name, (__u16 *)in_file_name, file_size);
 	wcstoutf8(path_name, (__u16 *)in_path_name, path_size);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux