Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2233224ybi; Thu, 20 Jun 2019 11:18:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMkU5zitpX/5nAGk9EIXxXP+rGGRQOOitP/scGMR4euH/ACsrb5D4DNk8tpCY0p5KXhb42 X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr83221512plb.76.1561054703501; Thu, 20 Jun 2019 11:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561054703; cv=none; d=google.com; s=arc-20160816; b=l3nITPHGG2E2dTV1/YnpTU/GiRhnN3aOnrn9VfqoqUFFJwfXfeBafiEgvnS4cgvFte izUKkbtGmRauQhYPHBaL2M4L7gK9LZa2zxfmWD914jBy7f0oV4FyFTUrVTOb0dkXjp8/ DV5nVZJWrjNA+C2QquwcGZwuYK0D0j3vKxrUT/GQYrMypo92RIpifkK8ObeJdRh4IRWU kZS0bpfW8eADstsGIu7Mssxq/24O0U7Bd7kDZ5GH5fz9nxzxpsVTr1Fum0UtBd/guELF 7ufrWtsUrcfIiMnwDOwTr2n5hSoW1L3JRnDAgcuJXXIrzfgjvzLpbQBqVOFQFswMN3VD 6Lzw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VaV63dOw3hEZa+KKI5m/oHBYq3ptnZBBiKrA+rYL0xA=; b=g5CA74F8Q9r8KOOyJi9y6c6wVp0t6uDq+f9ORIcu38P1+wYmdFCjreYvH2+hiGYu3A CSUbsaUevhOaAe7xoFni5fpu29vWuE2ZwaAT90YY+L/euMMbc4f0P8ZlvHaEyEG7vTYp 0go5EHI9O2uZc1ppiqnLJzPFHN9tF3uK3fTyPkWAbnw6RAKouIJXEcz5qqaXFdIn6o/U SsxD3h7PFq567iHeIcuZ7lJFl9kQIWfUc/W+rQ1mv9kwdNe5IhSCcrGCDn7tPkFKqQDN wvLISIzT7uxWOCGaKo3EuwACJy3VDGsV/xX2nhtqGKijo6xqivTG4/lFvwLuJsX8wXFN qGbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XpF8X8N9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si205704pgv.102.2019.06.20.11.18.08; Thu, 20 Jun 2019 11:18:23 -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=@kernel.org header.s=default header.b=XpF8X8N9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729845AbfFTSQu (ORCPT + 99 others); Thu, 20 Jun 2019 14:16:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:46038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbfFTSQt (ORCPT ); Thu, 20 Jun 2019 14:16:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9678A2082C; Thu, 20 Jun 2019 18:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561054609; bh=1WumT4QNTrBGXyIr87jAvTLP3RZS4pMvvwTqIzB615I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XpF8X8N9bZG6QESixh11rpSk2k3E4OT/LQnGTJb+JwGRlcqLV6i6ur1MwJVy3R9Oz CE/meGXGVP6nWg9Wvtd1e4BquDUqR3uiPVGK14lLA+CLXl1x/sjXzoxqgUtgjoRupZ r15gRuPmx01PpKpKZDv6Wd78Ad1LY/LJvgQKpEQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Varun Prakash , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.1 88/98] scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route() Date: Thu, 20 Jun 2019 19:57:55 +0200 Message-Id: <20190620174353.779238128@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174349.443386789@linuxfoundation.org> References: <20190620174349.443386789@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit cc555759117e8349088e0c5d19f2f2a500bafdbd ] ip_dev_find() can return NULL so add a check for NULL pointer. Signed-off-by: Varun Prakash Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/cxgbi/libcxgbi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 006372b3fba2..a50734f3c486 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -641,6 +641,10 @@ cxgbi_check_route(struct sockaddr *dst_addr, int ifindex) if (ndev->flags & IFF_LOOPBACK) { ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr); + if (!ndev) { + err = -ENETUNREACH; + goto rel_neigh; + } mtu = ndev->mtu; pr_info("rt dev %s, loopback -> %s, mtu %u.\n", n->dev->name, ndev->name, mtu); -- 2.20.1