From 67961d9f2d1114ae73c2192c3fa30ad9d809c098 Mon Sep 17 00:00:00 2001 From: Feeling Date: Wed, 10 May 2023 01:23:58 +0000 Subject: [PATCH] arch/um: fixed pointer access before check in destroy_queue() um inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I71R8G CVE: NA Reference: N/A ---------------------------------------------------------------- Since the qi pointer is accessed first in the function and then checked to see if it is NULL, an error could occur if qi is NULL anyway. The modification fixes the problem by checking the qi pointer before accessing it. Signed-off-by: Feeling --- arch/um/drivers/vector_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index 50ee3bb5a63a..02a447a39a9e 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -455,11 +455,13 @@ static void destroy_queue(struct vector_queue *qi) { int i; struct iovec *iov; - struct vector_private *vp = netdev_priv(qi->dev); + struct vector_private *vp; struct mmsghdr *mmsg_vector; if (qi == NULL) return; + else + vp = netdev_priv(qi->dev); /* deallocate any skbuffs - we rely on any unused to be * set to NULL. */ -- Gitee