mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
dm-snapshot: fix crash if dm_io_client_create fails
If dm_io_client_create() fails, it stores error into the ps->io_client variable. The code would try to free it later with dm_io_client_destroy(ps->io_client), causing an invalid pointer dereference. Fix this by setting ps->io_client = NULL. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Assisted-by: Claude:claude-opus-5 Cc: stable@vger.kernel.org
This commit is contained in:
parent
1acc65c30f
commit
829c4d2114
|
|
@ -325,8 +325,11 @@ static int read_header(struct pstore *ps, int *new_snapshot)
|
|||
}
|
||||
|
||||
ps->io_client = dm_io_client_create();
|
||||
if (IS_ERR(ps->io_client))
|
||||
return PTR_ERR(ps->io_client);
|
||||
if (IS_ERR(ps->io_client)) {
|
||||
r = PTR_ERR(ps->io_client);
|
||||
ps->io_client = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
r = alloc_area(ps);
|
||||
if (r)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user