[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211025131304.17226-1-cyeaa@connect.ust.hk>
Date: Mon, 25 Oct 2021 06:13:04 -0700
From: Chengfeng Ye <cyeaa@...nect.ust.hk>
To: damien.lemoal@...nsource.wdc.com
Cc: linux-kernel@...r.kernel.org, Chengfeng Ye <cyeaa@...nect.ust.hk>
Subject: [PATCH] driver/ata: fix potential null pointer dereference on pointer last_sge
The pointer cs_desc could be null if the loop is not
executed, so there is a potential NULL-PTR dereference
issue. Fix this by adding a null check before dereference.
Signed-off-by: Chengfeng Ye <cyeaa@...nect.ust.hk>
---
drivers/ata/sata_sil24.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 06a1e27c4f84..2bd595da799f 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -785,6 +785,8 @@ static inline void sil24_fill_sg(struct ata_queued_cmd *qc,
sge++;
}
+ if (!last_sge)
+ return;
last_sge->flags = cpu_to_le32(SGE_TRM);
}
--
2.17.1
Powered by blists - more mailing lists