Skip to content

Commit 0b0226b

Browse files
tititiou36gregkh
authored andcommitted
uio_hv_generic: Fix another memory leak in error handling paths
Memory allocated by 'vmbus_alloc_ring()' at the beginning of the probe function is never freed in the error handling path. Add the missing 'vmbus_free_ring()' call. Note that it is already freed in the .remove function. Fixes: cdfa835 ("uio_hv_generic: defer opening vmbus until first use") Cc: stable <stable@vger.kernel.org> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/0d86027b8eeed8e6360bc3d52bcdb328ff9bdca1.1620544055.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3ee098f commit 0b0226b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/uio/uio_hv_generic.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ hv_uio_probe(struct hv_device *dev,
291291
pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE);
292292
if (pdata->recv_buf == NULL) {
293293
ret = -ENOMEM;
294-
goto fail_close;
294+
goto fail_free_ring;
295295
}
296296

297297
ret = vmbus_establish_gpadl(channel, pdata->recv_buf,
@@ -351,6 +351,8 @@ hv_uio_probe(struct hv_device *dev,
351351

352352
fail_close:
353353
hv_uio_cleanup(dev, pdata);
354+
fail_free_ring:
355+
vmbus_free_ring(dev->channel);
354356

355357
return ret;
356358
}

0 commit comments

Comments
 (0)