]> Git Repo - linux.git/commitdiff
net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid
authorAnant Thazhemadam <[email protected]>
Mon, 12 Oct 2020 04:24:04 +0000 (09:54 +0530)
committerDominique Martinet <[email protected]>
Mon, 12 Oct 2020 08:05:47 +0000 (10:05 +0200)
In p9_fd_create_unix, checking is performed to see if the addr (passed
as an argument) is NULL or not.
However, no check is performed to see if addr is a valid address, i.e.,
it doesn't entirely consist of only 0's.
The initialization of sun_server.sun_path to be equal to this faulty
addr value leads to an uninitialized variable, as detected by KMSAN.
Checking for this (faulty addr) and returning a negative error number
appropriately, resolves this issue.

Link: http://lkml.kernel.org/r/[email protected]
Reported-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Anant Thazhemadam <[email protected]>
Signed-off-by: Dominique Martinet <[email protected]>
net/9p/trans_fd.c

index c0762a302162c9d2127143bf131c49d553706846..8f528e783a6c533f604371228b7e31c28ea87577 100644 (file)
@@ -1023,7 +1023,7 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
 
        csocket = NULL;
 
-       if (addr == NULL)
+       if (!addr || !strlen(addr))
                return -EINVAL;
 
        if (strlen(addr) >= UNIX_PATH_MAX) {
This page took 0.060975 seconds and 4 git commands to generate.