dm snap : add sanity checks to snapshot_ctr
PATCH 1/1 dm snap : add sanity checks to snapshot_ctr
Similar to commit<70de2cbda8a5>("dm thin: add sanity checks
to thin-pool and external snapshot creation"),there should be a check for argc and argv to prevent Null pointer dereferencing when the dm_get_device invoked twice on the same device path with differnt mode.
Signed-off-by Defang Bo <[email protected]>
--- drivers/md/dm-snap.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/md/dm-snap.c +7 -0
@@ -1258,6 +1258,13 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) as.argc = argc; as.argv = argv; + +if (!strcmp (argv[0 ], argv[1 ])) { + ti->error ="Error setting metadata or data device" ; + r = -EINVAL ; + goto bad; + } +dm_consume_args (&as,4 ); r =parse_snapshot_features (&as, s, ti);if (r)
Signature · 1 line
2.7.4