From patchwork Wed Aug 12 19:33:44 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: 1343885 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 4BRfyZ1qcQz9sTR; Thu, 13 Aug 2020 05:33:57 +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 1k5wVT-00060o-Qf; Wed, 12 Aug 2020 19:33:51 +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 1k5wVS-00060b-20 for kernel-team@lists.ubuntu.com; Wed, 12 Aug 2020 19:33:50 +0000 Received: from mail-qt1-f198.google.com ([209.85.160.198]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k5wVR-00030x-Nq for kernel-team@lists.ubuntu.com; Wed, 12 Aug 2020 19:33:49 +0000 Received: by mail-qt1-f198.google.com with SMTP id r24so2630335qtu.3 for ; Wed, 12 Aug 2020 12:33:49 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=lZ0xXCzHreEMwUP5q4wHDGeIfFpDNrrIHngOzER6Ojc=; b=N+E8aLpCWnqwILfUEWkRAcbf6jC7oAvAMhkpYMIHrqTA/psv6+ybxtrB8rhHV7Zypi yrhCySr/yF9TbY2vyn4qOYb8fLde8uB+pAtuyBXbN78sLj2rF7uzPb1rdp7SelU59g95 4j+pdFtK5tMW2hrvRVVMMISjobM5XCEbJo9fv60Y61G+VUmh86TgD7kP5Ba9F2yTFllk KrCK2VW899lMYZI7kzhEcQNaxI8oh1qpCumy+SYAPA9u9Y4EnoWg4UbAzU0Hv2UAUXdh 5v0vBrdauNS2tgPJ6kiuB1ttG1m2xQkxGSxmQqQsRgqHhaiuubK2p/Lb+SQKTb/nhCTG hvSQ== X-Gm-Message-State: AOAM533lKdR9r8oodcTl2tYIAnMH3Mnn6IxQ7Pkx3khd8EWrrMFI1RV0 EkHbQ3U78URzlLutk0fYRBbbD5CvQo6XFtbrTzGlYOxiCsuh3bepSpBPoZA9lNPEON0VYcxaI1B tA12d8MyUMhrNoz8ZHZnaEwxniaOTAnxXaqEkTrqouw== X-Received: by 2002:a05:620a:c99:: with SMTP id q25mr1413489qki.19.1597260828327; Wed, 12 Aug 2020 12:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyaVVV75VyEorC7S9b02ie+x6+okFTSTUfLNVoetyPgZ2WfGmVcZQc+/c/vxejLISCdMolig== X-Received: by 2002:a05:620a:c99:: with SMTP id q25mr1413475qki.19.1597260828059; Wed, 12 Aug 2020 12:33:48 -0700 (PDT) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id 22sm2988629qkg.24.2020.08.12.12.33.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 12:33:47 -0700 (PDT) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [BIONIC][CVE-2019-19054][PATCH] media: rc: prevent memory leak in cx23888_ir_probe Date: Wed, 12 Aug 2020 15:33:44 -0400 Message-Id: <20200812193345.64225-1-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200812175112.62557-1-william.gray@canonical.com> References: <20200812175112.62557-1-william.gray@canonical.com> 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 --- 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 040323b0f945..f63a7e6f272c 100644 --- a/drivers/media/pci/cx23885/cx23888-ir.c +++ b/drivers/media/pci/cx23885/cx23888-ir.c @@ -1178,8 +1178,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;