Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2684961pxy; Mon, 3 May 2021 05:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwCMgbxPdTUHLFoWFh++8wTJdFPdKiIJkQAwhrpfgvGgQmNHO7AuePNxFV0OeRehfkL/c2 X-Received: by 2002:a17:902:7c85:b029:ed:893d:ec7c with SMTP id y5-20020a1709027c85b02900ed893dec7cmr19966412pll.82.1620046570259; Mon, 03 May 2021 05:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620046570; cv=none; d=google.com; s=arc-20160816; b=PG2UqlWeHjSaElfjua1Cwk5HCck98EpHSM0VsucOyZhchez6qijC+BIy9kwK1XzT7W E/7DSQc1wPjhx1Z3eZJMVJVixFsCZaf1x7e22SBvPd14GJGP4bpqxfAYCshBTvPxrjiz KZucakNiLNw8ILXkPd5A5NxmQmBUVF/vIHm+RhjiEfDAG2ACN8a7Fcx5vv5XKhRQ67da rS3V5tm/b6ymguiEjXFTXaWOsgkD9tfW3QE3KuMSAs8pRri4R5p4eEom1J2LJk2s/n1/ 0eJpYHZRZvWXwELh85Ss6n7dTtJlqse4fafiz0HPUVVCfnIJasvoKfiSA65Wlz+vjaYS pvqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fzh63Aawn9uuqwvns7q2BZ8c9AFMCz8o8jpeoL7c8rU=; b=XqDBUTcgrUeIuUN2/NeE6NuJ7nl3u1qV5fo/6UtiH9IqPAo6Kfu+DCtGGx+1/9LhzQ OcVdQk9eIFgxv7AMu+PmM+ff0CIgtvg+2XpBEiThSHm2HkkUYg1jJ6XB0Ix3OamIJe31 A7PXxTSwNvutFIjz0z7n8vuqD8/r5iVE22/FnxazeJFoYN1SvZwK0LXa5LOoyHosxIG2 /teFbJMgaUJIaZlmK/lsjIlWMA4qH5lWXcuRKBlkOH+bjwu6sRBL/2IsIddUW7MrEZ4L Nnfiiznu0SABchwYp3rZBr+vqC+BjZ/6w7WkWT4QHeTjlF90Pg1pQB4TfEjQSexNK4zy orPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ea70LOzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p21si5733112pgn.112.2021.05.03.05.55.57; Mon, 03 May 2021 05:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ea70LOzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233606AbhECMAH (ORCPT + 99 others); Mon, 3 May 2021 08:00:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:33930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233518AbhECL76 (ORCPT ); Mon, 3 May 2021 07:59:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B02DB61249; Mon, 3 May 2021 11:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043145; bh=oES9GpstPbmoB3DUEyBFi7RyjixxSDp5TJe/hRrcfaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ea70LOzwX3AK41s7dKXbUrwf6z8OUCZNdGK6BlVMUPOxBAjHwYFm7y+kpL+jp9EtD FqCZJb49jC5Lyq0A+JGyL0cks0CNe2g3+XG6+fudoWlpMD55PwbcW0/BlJxmtlWa+F xKyBbYWSWL/nyb+CAIJZf8M7xUITEkleo/s1/16w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Anirudh Rayabharam , "David S. Miller" , Dominik Brodowski , Greg Kroah-Hartman Subject: [PATCH 15/69] net: fujitsu: fix potential null-ptr-deref Date: Mon, 3 May 2021 13:56:42 +0200 Message-Id: <20210503115736.2104747-16-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503115736.2104747-1-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anirudh Rayabharam In fmvj18x_get_hwinfo(), if ioremap fails there will be NULL pointer deref. To fix this, check the return value of ioremap and return -1 to the caller in case of failure. Cc: "David S. Miller" Cc: Dominik Brodowski Signed-off-by: Anirudh Rayabharam Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/fujitsu/fmvj18x_cs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/fujitsu/fmvj18x_cs.c b/drivers/net/ethernet/fujitsu/fmvj18x_cs.c index dc90c61fc827..b0c0504950d8 100644 --- a/drivers/net/ethernet/fujitsu/fmvj18x_cs.c +++ b/drivers/net/ethernet/fujitsu/fmvj18x_cs.c @@ -547,6 +547,11 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) return -1; base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); + if (!base) { + pcmcia_release_window(link, link->resource[2]); + return -1; + } + pcmcia_map_mem_page(link, link->resource[2], 0); /* -- 2.31.1