From: Thomas Hellstrom <thellstrom@vmware.com>
To: gregkh@linuxfoundation.org, brianp@vmware.com,
stable@vger.kernel.org, syeh@vmware.com
Subject: Re: FAILED: patch "[PATCH] drm/vmwgfx: Fix host logging / guestinfo reading error paths" failed to apply to 4.16-stable tree
Date: Mon, 28 May 2018 17:15:37 +0200 [thread overview]
Message-ID: <b9ebfa45-2599-e5da-1d88-3de244544e1d@vmware.com> (raw)
In-Reply-To: <152734025414271@kroah.com>
Hi,
On 05/26/2018 03:10 PM, gregkh@linuxfoundation.org wrote:
> The patch below does not apply to the 4.16-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h
The IMO best option is to cherry-pick commit
6073a09210e06 "drm/vmwgfx: Use kasprintf"
by Himanshu Jha. It doesn't fix anything but is small and makes the
below patch apply cleanly.
Thanks,
Thomas
> ------------------ original commit in Linus's tree ------------------
>
> From f37230c0ad481091bc136788ff8b37dc86300c6d Mon Sep 17 00:00:00 2001
> From: Thomas Hellstrom <thellstrom@vmware.com>
> Date: Wed, 23 May 2018 16:13:20 +0200
> Subject: [PATCH] drm/vmwgfx: Fix host logging / guestinfo reading error paths
>
> The error paths were leaking opened channels.
> Fix by using dedicated error paths.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Reviewed-by: Brian Paul <brianp@vmware.com>
> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> index cdff99211602..21d746bdc922 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> @@ -329,8 +329,6 @@ int vmw_host_get_guestinfo(const char *guest_info_param,
> struct rpc_channel channel;
> char *msg, *reply = NULL;
> size_t reply_len = 0;
> - int ret = 0;
> -
>
> if (!vmw_msg_enabled)
> return -ENODEV;
> @@ -344,15 +342,14 @@ int vmw_host_get_guestinfo(const char *guest_info_param,
> return -ENOMEM;
> }
>
> - if (vmw_open_channel(&channel, RPCI_PROTOCOL_NUM) ||
> - vmw_send_msg(&channel, msg) ||
> - vmw_recv_msg(&channel, (void *) &reply, &reply_len) ||
> - vmw_close_channel(&channel)) {
> - DRM_ERROR("Failed to get %s", guest_info_param);
> + if (vmw_open_channel(&channel, RPCI_PROTOCOL_NUM))
> + goto out_open;
>
> - ret = -EINVAL;
> - }
> + if (vmw_send_msg(&channel, msg) ||
> + vmw_recv_msg(&channel, (void *) &reply, &reply_len))
> + goto out_msg;
>
> + vmw_close_channel(&channel);
> if (buffer && reply && reply_len > 0) {
> /* Remove reply code, which are the first 2 characters of
> * the reply
> @@ -369,7 +366,17 @@ int vmw_host_get_guestinfo(const char *guest_info_param,
> kfree(reply);
> kfree(msg);
>
> - return ret;
> + return 0;
> +
> +out_msg:
> + vmw_close_channel(&channel);
> + kfree(reply);
> +out_open:
> + *length = 0;
> + kfree(msg);
> + DRM_ERROR("Failed to get %s", guest_info_param);
> +
> + return -EINVAL;
> }
>
>
> @@ -400,15 +407,22 @@ int vmw_host_log(const char *log)
> return -ENOMEM;
> }
>
> - if (vmw_open_channel(&channel, RPCI_PROTOCOL_NUM) ||
> - vmw_send_msg(&channel, msg) ||
> - vmw_close_channel(&channel)) {
> - DRM_ERROR("Failed to send log\n");
> + if (vmw_open_channel(&channel, RPCI_PROTOCOL_NUM))
> + goto out_open;
>
> - ret = -EINVAL;
> - }
> + if (vmw_send_msg(&channel, msg))
> + goto out_msg;
>
> + vmw_close_channel(&channel);
> kfree(msg);
>
> - return ret;
> + return 0;
> +
> +out_msg:
> + vmw_close_channel(&channel);
> +out_open:
> + kfree(msg);
> + DRM_ERROR("Failed to send log\n");
> +
> + return -EINVAL;
> }
>
next prev parent reply other threads:[~2018-05-28 15:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-26 13:10 FAILED: patch "[PATCH] drm/vmwgfx: Fix host logging / guestinfo reading error paths" failed to apply to 4.16-stable tree gregkh
2018-05-28 15:15 ` Thomas Hellstrom [this message]
2018-05-30 8:35 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9ebfa45-2599-e5da-1d88-3de244544e1d@vmware.com \
--to=thellstrom@vmware.com \
--cc=brianp@vmware.com \
--cc=gregkh@linuxfoundation.org \
--cc=stable@vger.kernel.org \
--cc=syeh@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.