From: Jia-Ju Bai <hidden> Date: 2019-07-26 02:25:44
In inet_csk_rebuild_route(), rt is assigned to NULL on line 1071.
On line 1076, rt is used:
return &rt->dst;
Thus, a possible null-pointer dereference may occur.
To fix this bug, rt is checked before being used.
This bug is found by a static analysis tool STCheck written by us.
Signed-off-by: Jia-Ju Bai <redacted>
---
net/ipv4/inet_connection_sock.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: Nicolas Dichtel <hidden> Date: 2019-07-26 09:16:01
Le 26/07/2019 à 04:25, Jia-Ju Bai a écrit :
quoted hunk
In inet_csk_rebuild_route(), rt is assigned to NULL on line 1071.
On line 1076, rt is used:
return &rt->dst;
Thus, a possible null-pointer dereference may occur.>
To fix this bug, rt is checked before being used.
This bug is found by a static analysis tool STCheck written by us.
Signed-off-by: Jia-Ju Bai <redacted>
---
net/ipv4/inet_connection_sock.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Hmm, ->dst is the first field (and that will never change), thus &rt->dst is
NULL if rt is NULL.
I don't think there is a problem with the current code.
Regards,
Nicolas
If rt is NULL, &rt->dst is also NULL as has been pointed out to you.
Please fix your automated tools to understand this case before submitting
more changes.
Thank you.