lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.13 648/800] staging: mmal-vchiq: Fix incorrect static vchiq_instance.
    Date
    From: Dave Stevenson <dave.stevenson@raspberrypi.com>

    [ Upstream commit afc023da53e46b88552822f2fe035c7129c505a2 ]

    For some reason lost in history function vchiq_mmal_init used
    a static variable for storing the vchiq_instance.
    This value is retrieved from vchiq per instance, so worked fine
    until you try to call vchiq_mmal_init multiple times concurrently
    when things then go wrong. This seemed to happen quite frequently
    if using the cutdown firmware (no MMAL or VCSM services running)
    as the vchiq_connect then failed, and one or other vchiq_shutdown
    was working on an invalid handle.

    Remove the static so that each caller gets a unique vchiq_instance.

    Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
    Link: https://lore.kernel.org/r/1621979857-26754-1-git-send-email-stefan.wahren@i2se.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
    index 06bca7be5203..76d3f0399964 100644
    --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
    +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
    @@ -1862,7 +1862,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
    int status;
    int err = -ENODEV;
    struct vchiq_mmal_instance *instance;
    - static struct vchiq_instance *vchiq_instance;
    + struct vchiq_instance *vchiq_instance;
    struct vchiq_service_params_kernel params = {
    .version = VC_MMAL_VER,
    .version_min = VC_MMAL_MIN_VER,
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-07-12 11:10    [W:2.423 / U:0.208 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site