uio_hv_generic: Fix a memory leak in error handling paths
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 9 May 2021 07:13:03 +0000 (09:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 May 2021 10:06:52 +0000 (12:06 +0200)
commitd84b5e912212b05f6b5bde9f682046accfbe0354
tree62da59aea6dc1af467b32c97cbaf4aad4edf5526
parentb044f5108e4b563c5b3349b438ae1493d045046d
uio_hv_generic: Fix a memory leak in error handling paths

commit 3ee098f96b8b6c1a98f7f97915f8873164e6af9d upstream.

If 'vmbus_establish_gpadl()' fails, the (recv|send)_gpadl will not be
updated and 'hv_uio_cleanup()' in the error handling path will not be
able to free the corresponding buffer.

In such a case, we need to free the buffer explicitly.

Fixes: cdfa835c6e5e ("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/4fdaff557deef6f0475d02ba7922ddbaa1ab08a6.1620544055.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_hv_generic.c