All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ui/vnc: Add missing lock for send_color_map
@ 2020-11-16 14:13 Peng Liang
  2020-11-23  2:32 ` Peng Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Liang @ 2020-11-16 14:13 UTC (permalink / raw)
  To: qemu-devel
  Cc: liangpeng10, zhang.zhanghailiang, qemu-stable, xiexiangyou, kraxel

vnc_write() should be locked after the RFB protocol is initialized.

Fixes: 0c426e4534b4 ("vnc: Add support for color map")
Cc: qemu-stable@nongnu.org
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
---
 ui/vnc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ui/vnc.c b/ui/vnc.c
index 49235056f7a8..ca3fc376aeb5 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2156,6 +2156,7 @@ static void send_color_map(VncState *vs)
 {
     int i;
 
+    vnc_lock_output(vs);
     vnc_write_u8(vs, VNC_MSG_SERVER_SET_COLOUR_MAP_ENTRIES);
     vnc_write_u8(vs,  0);    /* padding     */
     vnc_write_u16(vs, 0);    /* first color */
@@ -2168,6 +2169,7 @@ static void send_color_map(VncState *vs)
         vnc_write_u16(vs, (((i >> pf->gshift) & pf->gmax) << (16 - pf->gbits)));
         vnc_write_u16(vs, (((i >> pf->bshift) & pf->bmax) << (16 - pf->bbits)));
     }
+    vnc_unlock_output(vs);
 }
 
 static void set_pixel_format(VncState *vs, int bits_per_pixel,
-- 
2.28.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ui/vnc: Add missing lock for send_color_map
  2020-11-16 14:13 [PATCH] ui/vnc: Add missing lock for send_color_map Peng Liang
@ 2020-11-23  2:32 ` Peng Liang
  0 siblings, 0 replies; 2+ messages in thread
From: Peng Liang @ 2020-11-23  2:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: zhang.zhanghailiang, qemu-stable, xiexiangyou, kraxel

Kindly ping.

On 11/16/2020 10:13 PM, Peng Liang wrote:
> vnc_write() should be locked after the RFB protocol is initialized.
> 
> Fixes: 0c426e4534b4 ("vnc: Add support for color map")
> Cc: qemu-stable@nongnu.org
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Peng Liang <liangpeng10@huawei.com>
> ---
>  ui/vnc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 49235056f7a8..ca3fc376aeb5 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -2156,6 +2156,7 @@ static void send_color_map(VncState *vs)
>  {
>      int i;
>  
> +    vnc_lock_output(vs);
>      vnc_write_u8(vs, VNC_MSG_SERVER_SET_COLOUR_MAP_ENTRIES);
>      vnc_write_u8(vs,  0);    /* padding     */
>      vnc_write_u16(vs, 0);    /* first color */
> @@ -2168,6 +2169,7 @@ static void send_color_map(VncState *vs)
>          vnc_write_u16(vs, (((i >> pf->gshift) & pf->gmax) << (16 - pf->gbits)));
>          vnc_write_u16(vs, (((i >> pf->bshift) & pf->bmax) << (16 - pf->bbits)));
>      }
> +    vnc_unlock_output(vs);
>  }
>  
>  static void set_pixel_format(VncState *vs, int bits_per_pixel,
> 

Thanks,
Peng


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-23  2:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 14:13 [PATCH] ui/vnc: Add missing lock for send_color_map Peng Liang
2020-11-23  2:32 ` Peng Liang

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.