From patchwork Wed Aug 12 17:51:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1343825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BRckw6ghyz9sRK; Thu, 13 Aug 2020 03:53:43 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1k5uwR-0000gO-UQ; Wed, 12 Aug 2020 17:53:35 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k5uwQ-0000gH-JC for kernel-team@lists.ubuntu.com; Wed, 12 Aug 2020 17:53:34 +0000 Received: from mail-qk1-f200.google.com ([209.85.222.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k5uwQ-00034S-8u for kernel-team@lists.ubuntu.com; Wed, 12 Aug 2020 17:53:34 +0000 Received: by mail-qk1-f200.google.com with SMTP id f18so2053042qke.0 for ; Wed, 12 Aug 2020 10:53:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VBAvAbxWj1qhN4szGNllgSgGIRU1nxI37UIRnaGY8RA=; b=T9Q+nhTFoVED1JuPsalLhRdJ2+PbRLzbtmuDxtX5jjz3r06W4TL830Myt2lpoKZItj Wn4WS4x36CQn5MrBjmewnFhY6SWHu1ZUj44FMGbUl3VkSyGmQyMLLVtkNgezyEITnKqk DvnX6v82LIUshwNTwzd0NpjLGsLQPsfqngzCfHt47CyU6yffxtwnBIThtisolDBULUWb mkDMONjbct3YaQEIPtZU17ZFmJalxytLnxI+iK9+DNEiQCpuHTX0wlrUGkIi6hC5tWjn HdOaqo7PDXzJuGZZUpMlC5ZrJ6t8ERIIzWVg9sHdyxiDpy42ELjcuBME0sTC9ibolzwM T2EQ== X-Gm-Message-State: AOAM530uvKJyLC45c172u6kVRWbZohVkrrcKbU3JTpt3ES3G58ZdXlbJ MUFWBATK4aCF0KQWtled2geEfzkIAa9QdatZ0BsjcgFEds09tdAttK9TkbYvqKjpxCHrpiLPqzo a/YSlZSYYqh01vjkwJCKRdNhva8xFZnFjeJLAJaKYPA== X-Received: by 2002:ac8:5143:: with SMTP id h3mr830394qtn.229.1597254813110; Wed, 12 Aug 2020 10:53:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytcsxDPlsVlvcvHqztPOpVPdbNPkeB/JWAYOUwzkZZQYIfk0kfNSOhBmJfpREy2kJ/NU05Bw== X-Received: by 2002:ac8:5143:: with SMTP id h3mr830375qtn.229.1597254812878; Wed, 12 Aug 2020 10:53:32 -0700 (PDT) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id d8sm3328191qtr.12.2020.08.12.10.53.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 10:53:32 -0700 (PDT) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [FOCAL][CVE-2019-19054][PATCH] media: rc: prevent memory leak in cx23888_ir_probe Date: Wed, 12 Aug 2020 13:51:12 -0400 Message-Id: <20200812175112.62557-1-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Navid Emamdoost In cx23888_ir_probe if kfifo_alloc fails the allocated memory for state should be released. Signed-off-by: Navid Emamdoost Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab CVE-2019-19054 (cherry picked from a7b2df76b42bdd026e3106cf2ba97db41345a177) Signed-off-by: William Breathitt Gray Acked-by: Colin Ian King Acked-by: Stefan Bader --- drivers/media/pci/cx23885/cx23888-ir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c index e880afe37f15..d59ca3601785 100644 --- a/drivers/media/pci/cx23885/cx23888-ir.c +++ b/drivers/media/pci/cx23885/cx23888-ir.c @@ -1167,8 +1167,11 @@ int cx23888_ir_probe(struct cx23885_dev *dev) return -ENOMEM; spin_lock_init(&state->rx_kfifo_lock); - if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL)) + if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, + GFP_KERNEL)) { + kfree(state); return -ENOMEM; + } state->dev = dev; sd = &state->sd;