Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp522551imm; Wed, 20 Jun 2018 02:11:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLCZKf98enysNT1q6uETnps+x6N4SU5bmPFOVNB4ZnA/jrvAaWNBNOxCWAYKuiznKF7YXX9 X-Received: by 2002:a63:9246:: with SMTP id s6-v6mr1024573pgn.35.1529485899302; Wed, 20 Jun 2018 02:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529485899; cv=none; d=google.com; s=arc-20160816; b=Apa74N1aukX4ocEe3DnADLru7BXEnd98004ur/9ZqmVGyuANpXMPApBL/OoEH/VHaj CZZS6qUGIuU6xVQI7Adb8L/nY0xSHvISoIoygZ8twyetRiLRR/2dmuZs0dpof2gjDaZn 5c2rxovDSsvbYpeoqhTgmTSiWtWCPIC2k0X+lwy1A87L3IH1t/Q469Fqm+QtPKMkfWVN N7mlpqj5rSRTV84E9DOuyyEzyQBKFjj2GOxNiiRMTYQ7RwPZLoRgKl5VHqQQHLriVZu6 xOv12oSredBICnMZBGWIIBiuCuoS4xrwOGXiJC7GiOJluRfNZ+KWr8rqbcYxHr16vz16 HIjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=goKmHpHCaGRBPJcTlA5nNXrblVXj3JcEECW6ZSIzQAw=; b=nH5RyW8AzA/yse2NmSSc8Q6CuR8Xik9Slw7aTZszVP3+cqviXKapVBcnECp58aCQU6 5zEQ4Y69XX+UFs6n7xdPQLTZiYUCTK53vcb1SzyqhTZyNrWSyZbk6z3gWlo+PybGnxRm Y+7240WbAQIwzmWniM2hk6BTcttJZda4HJ0U1CrxWK62xKUpjYhN8PvaqqgMxkCNIrtR 1gnfYWP2CijcDGjeaG82gGO+PsExtnjTJlIdHAkciCrgh0Rq1Y8v/hLn6hBwhq+aMSFQ 5bDMgjJVFk9fhSi+UQCz3YdMphP6iMnNFATJucYb4Ka62tPoScuuFUqK+ryHAnU167mN /5Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=AFnPV3KF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si1983987plx.517.2018.06.20.02.11.25; Wed, 20 Jun 2018 02:11:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=AFnPV3KF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754808AbeFTJKn (ORCPT + 99 others); Wed, 20 Jun 2018 05:10:43 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:33254 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754059AbeFTIfD (ORCPT ); Wed, 20 Jun 2018 04:35:03 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5K8XSG0100918; Wed, 20 Jun 2018 08:34:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=goKmHpHCaGRBPJcTlA5nNXrblVXj3JcEECW6ZSIzQAw=; b=AFnPV3KFVQ3vaBoUEYIoup6jX8NG/mCz3aj3j7jkenWWwZ8ajb2KrHdvnzkOn9r/hKVJ ktFM7zv6AKiJzq2T5y2D4nQ1iDLw8dFNMdoFURPSlJEaTRt/iJnL+ygw6oSz7F+XRd0s DJ2avRAW12K42ZJNb3p82yj5bMBvncUkFQtXMebnoIf8wPIYzmosUfFcy82QUyIfhbpD 2RC1cff4idNgMgBa5aI2+qn5wvimzLrxeVgxoJGx2EG21hmSTtcJyE2cPy4wIL2Gii5K gcRga9PFa9OPpLiqQJRFVewhOEJs1s+qlM0hIJy/K3TQJ/i17jwnhFAtcIvYGIKU7o3V sw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2jmtgwudvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jun 2018 08:34:57 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5K8Yt9p016333 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Jun 2018 08:34:56 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5K8Ysuf016460; Wed, 20 Jun 2018 08:34:54 GMT Received: from mwanda (/197.157.34.185) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Jun 2018 01:34:53 -0700 Date: Wed, 20 Jun 2018 11:34:39 +0300 From: Dan Carpenter To: Hugo Lefeuvre Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Marcus Wolf , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: pi433: fix race condition in pi433_open Message-ID: <20180620083439.6ouovmhsc235aprw@mwanda> References: <20180620023326.GA30440@hle-laptop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180620023326.GA30440@hle-laptop.local> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=873 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806200098 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 19, 2018 at 10:33:26PM -0400, Hugo Lefeuvre wrote: > @@ -1178,6 +1152,11 @@ static int pi433_probe(struct spi_device *spi) > device->tx_active = false; > device->interrupt_rx_allowed = false; > > + /* init rx buffer */ > + device->rx_buffer = kmalloc(MAX_MSG_SIZE, GFP_KERNEL); > + if (!device->rx_buffer) > + return -ENOMEM; We need to free device. > + > /* init wait queues */ > init_waitqueue_head(&device->tx_wait_queue); > init_waitqueue_head(&device->rx_wait_queue); > @@ -1280,6 +1259,7 @@ static int pi433_probe(struct spi_device *spi) > minor_failed: > free_gpio(device); > GPIO_failed: > + kfree(device->rx_buffer); > kfree(device); > > return retval; regards, dan carpenter