blkmapd: fix NULL dereference in bl_add_disk
Subsystems (2)
PATCH 1/1 blkmapd: fix NULL dereference in bl_add_disk
Check serial and disk->serial for NULL before comparing to prevent NULL pointer dereferencing.
Fixes 6b9d7ab4 ("blkmapd: Add complex block layout discovery and mapping daemon")
Signed-off-by Alexandra Diupina <[email protected]>
--- utils/blkmapd/device-discovery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
utils/blkmapd/device-discovery.c +2 -1
@@ -179,7 +179,8 @@ static void bl_add_disk(char *filepath)/* Already scanned or a partition? * XXX: if released each time, maybe not need to compare */ -if ((serial->len == disk->serial->len) && +if (serial && disk->serial && + (serial->len == disk->serial->len) && !memcmp (serial->data, disk->serial->data, serial->len)) { diskpath =bl_get_path (filepath, disk->paths);break ;
Signature · 1 line
2.30.2