> From: linux-kernel-owner@xxxxxxxxxxxxxxx [mailto:linux-kernel- > owner@xxxxxxxxxxxxxxx] On Behalf Of kys@xxxxxxxxxxxxxxxxxxxxxx > Sent: Monday, March 13, 2017 11:01 > To: gregkh@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; > devel@xxxxxxxxxxxxxxxxxxxxxx; olaf@xxxxxxxxx; apw@xxxxxxxxxxxxx; > vkuznets@xxxxxxxxxx; jasowang@xxxxxxxxxx; > leann.ogasawara@xxxxxxxxxxxxx; marcelo.cerri@xxxxxxxxxxxxx > Cc: KY Srinivasan <kys@xxxxxxxxxxxxx> > Subject: [PATCH 1/1] Drivers: hv: vmbus: Don't leak memory when a channel > is rescinded > > > From: K. Y. Srinivasan <kys@xxxxxxxxxxxxx> > > When we close a channel that has been rescinded, we will leak memory > since > vmbus_teardown_gpadl() returns an error. Fix this so that we can properly > cleanup the memory allocated to the ring buffers. > > Fixes: ccb61f8a99e6 ("Drivers: hv: vmbus: Fix a rescind handling bug") > > Signed-off-by: K. Y. Srinivasan <kys@xxxxxxxxxxxxx> > --- > drivers/hv/channel.c | 13 ++++++++----- > 1 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c > index 54075ac..e9b0fab 100644 > --- a/drivers/hv/channel.c > +++ b/drivers/hv/channel.c > @@ -502,12 +502,15 @@ int vmbus_teardown_gpadl(struct vmbus_channel > *channel, u32 gpadl_handle) > > wait_for_completion(&info->waitevent); > > - if (channel->rescind) { > - ret = -ENODEV; > - goto post_msg_err; > - } > - > post_msg_err: > + /* > + * If the channel has been rescinded; > + * we will be awakened by the rescind > + * handler; set the error code to zero so we don't leak memory. > + */ > + if (channel->rescind) > + ret = 0; > + > spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); > list_del(&info->msglistentry); > spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); > -- Hi Greg, Can you please apply the patch to the stable tree too? The patch has been on char-misc.git tree's char-misc-linus branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?h=char-misc-linus&id=5e030d5ce9d99a899b648413139ff65bab12b038 but the patch lacks a "Cc: <stable@xxxxxxxxxxxxxxx>" tag. Thanks, -- Dexuan