From patchwork Wed Jan 10 09:36:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10154643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 733E660231 for ; Wed, 10 Jan 2018 09:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6998622064 for ; Wed, 10 Jan 2018 09:37:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DB4622F3E; Wed, 10 Jan 2018 09:37:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3364322064 for ; Wed, 10 Jan 2018 09:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756159AbeAJJhL (ORCPT ); Wed, 10 Jan 2018 04:37:11 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47760 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754461AbeAJJg4 (ORCPT ); Wed, 10 Jan 2018 04:36:56 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0A9Wq16172671; Wed, 10 Jan 2018 09:36:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=giu9liJz/MdzQnx936EwUTFHIAZvuIdhllJNOBZaCNU=; b=CMW34CTSq9AIM6IYfNZQd593ItzyYP9sHeazpZK9KMLflvs6qjZ28XmKXM6rAMzQwIbz 6pGXZZpvBg5LG2gp+9w9EjD2B4m8jgafJiCxnzWKak/qXg1M7wVRGQMssV24h5+gxU/y /+Hx62aKW+yGir1Qay6ksj2mw3FwPowwoVtrmlNfFYc062QxoZF3Y87ZjZn9GZd6aM00 cvk+TL93/WC2Zf7wZlHU6Nn1w8ASYNlsriSCV9rKRHMFR16Gq2KCgkw/wyB1+YA8imu0 JElHbidb24EPhJr7NKKw16R7DfM27y3rK/U0SKoWrTgkxzrmGg9yanXdO6YqyL4Hmvou Ng== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2fd8jn17yq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2018 09:36:33 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0A9aWu2004186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Jan 2018 09:36:32 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w0A9aU5N027557; Wed, 10 Jan 2018 09:36:31 GMT Received: from mwanda (/41.202.241.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Jan 2018 01:36:30 -0800 Date: Wed, 10 Jan 2018 12:36:23 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab , Sean Young Cc: David =?iso-8859-1?Q?H=E4rdeman?= , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] media: lirc: Fix uninitialized variable in ir_lirc_transmit_ir() Message-ID: <20180110093623.z5kqrsnu72stchu5@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8769 signatures=668652 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=947 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801100133 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The "txbuf" is uninitialized when we call ir_raw_encode_scancode() so this failure path would lead to a crash. Fixes: a74b2bff5945 ("media: lirc: do not pass ERR_PTR to kfree") Signed-off-by: Dan Carpenter diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index fae42f120aa4..5efe9cd2309a 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -295,7 +295,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, ret = ir_raw_encode_scancode(scan.rc_proto, scan.scancode, raw, LIRCBUF_SIZE); if (ret < 0) - goto out_kfree; + goto out_free_raw; count = ret; @@ -366,6 +366,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, return n; out_kfree: kfree(txbuf); +out_free_raw: kfree(raw); out_unlock: mutex_unlock(&dev->lock);