]> xenbits.xensource.com Git - qemu-xen.git/commit
qemu-nbd: regression with arguments passing into nbd_client_thread()
authorDenis V. Lunev <den@openvz.org>
Thu, 27 Jul 2023 10:58:28 +0000 (12:58 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 31 Jul 2023 06:10:51 +0000 (09:10 +0300)
commit5a61789df8accdfb715ed081ccb114f4776492c9
tree9edaceba274a3de0e364e6b02f22b8f2697b2ee5
parentbdfecfbc1d59bc9a0c2cc5c82690c8939520c8a2
qemu-nbd: regression with arguments passing into nbd_client_thread()

Unfortunately
    commit 03b67621445d601c9cdc7dfe25812e9f19b81488
    (8.0:  feb0814b3b48e75b336ad72eb303f9d579c94083)
    Author: Denis V. Lunev <den@openvz.org>
    Date:   Mon Jul 17 16:55:40 2023 +0200
    qemu-nbd: pass structure into nbd_client_thread instead of plain char*
has introduced a regression. struct NbdClientOpts resides on stack inside
'if' block. This specifically means that this stack space could be reused
once the execution will leave that block of the code.

This means that parameters passed into nbd_client_thread could be
overwritten at any moment.

The patch moves the data to the namespace of main() function effectively
preserving it for the whole process lifetime.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
CC: <qemu-stable@nongnu.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-ID: <20230727105828.324314-1-den@openvz.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit e5b815b0defcc3617f473ba70c3e675ef0ee69c2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: add reference to feb0814b3b48e75b336ad72eb303f9d579c94083 for 8.0 branch)
qemu-nbd.c