Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1507139img; Tue, 19 Mar 2019 09:04:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZcLczEudTkr7/fcW00NFr16WGnltLBsTKXeoAts6fpoyOKs7+3sjn3Ml5UazH3rCRmD44 X-Received: by 2002:a17:902:b216:: with SMTP id t22mr3251372plr.39.1553011473975; Tue, 19 Mar 2019 09:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553011473; cv=none; d=google.com; s=arc-20160816; b=v1TODK+0FOHrAuqbh3VC6cUkoxHDLLImOSg6VkRNIGdWNEX0qc82aY2fcVC5JvP5cP r5EmAmjxsiMu2Z8EigtD17bOUEEwPYRMXVs7HXoBOsUtK4wj0kzd1iHHRGrLVraNCohm GuwST7qQBEPOFJe0kqPyV0LlrsFrihC7RNDVeZQlh0VB+7CmeeDq+xdH5GGQEdIlHfPz flZug7n5y+YMdHGKao/bqrdbMxL7tPEeB1qtVsxY5YW5yBwF9NR+HRA5F6lgTaJLVOc7 6yQz/XqsY5E31AqSDudbT4FdhnVdJh2x18AzSsp3maVtmQt1yW3Lcno09IPDm/6lSU8C CZIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=YdILYVFcBdqt+Cx2Qqw1NS791l1k0hHY6kpyCHNeHeI=; b=hYHGAidKA0tjLyFf2ImA50dP38P1Rr7SoYfvougKO36s52fryDdWSKLxW/+d0iEept hdfVRAPan3Fs7YTQX6U2VfvQLnxMIeQzC5K5j0MeTX+CqawXEBjS3tuII1UOrYoibZRV VQS0TennYcdGhP/V9vlN754lhuK83c87mNyGAJ5RkDMMcJpQPo+nTc626C1oIQYDu79j QUrGzkDfui6MC141o7L2jQ09AUORWye/1sBMHiw5wp687Gc7I3RJExMTCXIHroL6EF8T Y4ZBurshERfy6zqSAWgRgV/dCu1YAPrkLZHKGzmrnIk3qcmDjcmbUdT/pd6/lnQGr7rz 6e+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CAOUZXuW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w14si4751551pga.584.2019.03.19.09.04.18; Tue, 19 Mar 2019 09:04:33 -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=@gmail.com header.s=20161025 header.b=CAOUZXuW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727881AbfCSQDR (ORCPT + 99 others); Tue, 19 Mar 2019 12:03:17 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39624 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbfCSQDQ (ORCPT ); Tue, 19 Mar 2019 12:03:16 -0400 Received: by mail-wr1-f68.google.com with SMTP id j9so7650776wrn.6; Tue, 19 Mar 2019 09:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YdILYVFcBdqt+Cx2Qqw1NS791l1k0hHY6kpyCHNeHeI=; b=CAOUZXuWm36w7ybzF+V0FuH9FUQSaRGTmtLYgbS3Jb7F9tg9/qHPIbQNYHjXnoBB3E oFAzDtrlJpkjF1Wfm0W4FC7T0nGr+bMPPY5/oxe4A/r3Q5s7AqmXbZO52U7cbOmGByKY whgvz1+BGnrs50eb8WDZB8mdCaoltFqrMmKCc1HBbpz0UYmk5uQ05ytVwvfEAsDVaFnO qEVBjzFyeMB+jA4+cPb6sIr0uJs8lGIEhkTHryQSP4DkxQtmKmpR5XTKwEcDSoaVnZq2 hUw5UzIqaXE42hzdjDV5MhaZkzVguVuQROWKJ6OWAuLHwDr+PTBe7FWXvxpDFe6Qy7qb CpYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YdILYVFcBdqt+Cx2Qqw1NS791l1k0hHY6kpyCHNeHeI=; b=KFkyQqz0VDK/O+faR0/5j2i+kVDQDFDbLl6pLjacc8QmLBOsl8quc2Azfrf3zjpUMx +s03ib8rqOpy5EV2TAHSvsTf6Cqo2nOFQxa1/pHmJq1fikIYT8rlxLaUZlkq8gWG3iXz Ynxq9IJZZJPcY7jUMLa43EQHPyP0rCmYEpqBJwv0XXYAtwZO/+ke9sOPgmI7vSuYZGg1 tDBv2D4vpZgTiQPEdN4B49y20Gr2pU8K61ZeluEkJUCawav1mRpWxue4pdSNmZTaSSRU RehJASo92POgqVrmhCSLH7Ypqrzn/1gL03j3RNayL3BajKd1S7KJL+nr2DidGxCGWkgz 1pQw== X-Gm-Message-State: APjAAAWbV/ZXTNiuUno+AcPaQr6lJL2S9KKBGoBhMs7jr6RxH51OwJnL wbPOJaG+SYKtWMQY6DXvT/PpOIKD X-Received: by 2002:a5d:62c4:: with SMTP id o4mr12335867wrv.282.1553011393637; Tue, 19 Mar 2019 09:03:13 -0700 (PDT) Received: from [172.31.96.190] ([195.39.71.253]) by smtp.gmail.com with ESMTPSA id q24sm4836626wmq.5.2019.03.19.09.03.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 09:03:12 -0700 (PDT) Subject: Re: [PATCH v3] net: mlx5: Add a missing check on idr_find, free buf To: Aditya Pakki Cc: kjlu@umn.edu, Boris Pismenny , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Ilya Lesokhin , Wei Yongjun , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190319155524.6978-1-pakki001@umn.edu> From: Eric Dumazet Message-ID: <60539cb4-1dfb-d307-f761-61ff5459e3ac@gmail.com> Date: Tue, 19 Mar 2019 09:03:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190319155524.6978-1-pakki001@umn.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/19/2019 08:55 AM, Aditya Pakki wrote: > idr_find() can return a NULL value to 'flow' which is used without a check. > The patch adds a check to avoid potential NULL pointer dereference. > In case of mlx5_fpga_sbu_conn_sendmsg() failure, free buf allocated > using kzalloc. > > --- > v2: failure to return in case of flow failure. > v1: Failed to free buf in case of flow failure. > > Signed-off-by: Aditya Pakki Please add an appropriate Fixes: tag, thanks.