Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2624194pxj; Mon, 31 May 2021 06:50:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvFtoi8k1P4hBW3LySDQifbi1PFueupJ6SApt0fgVVyOE3GpojR1ieOrNAQzDFrf5j/+xI X-Received: by 2002:a05:6402:12d8:: with SMTP id k24mr15271585edx.47.1622469002063; Mon, 31 May 2021 06:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622469002; cv=none; d=google.com; s=arc-20160816; b=nkT/X6M5HlfDKyqRQ7UVbcNS47PFtF5TmQjWpYkMQB6XYCHam7r3JJmOKcP5RmVb26 fP3CqoeUIYgGy9+YueI/xc70hW9qsfOfjLkybrQVFS6aydjiwV9FYl9mS1H+ZsukNfcL 1kfePwyGfgtzYDv7hB9LZhcokf0bOqEuhzp8dOJobjZNJryEjD+/bH36N6RQgWjjbQGa 6LIFUrXw51gIy7gYC3mbqDdMPlLd9amLsYNuGejmICOmr/omOAGVLfFykoB0FSFR9jGD s1svPVDqaWDVAb5qTN6kBUl2vW5Uoio4bxyXr/RaIaQUQSajLKxgyYx1pYQxeUyloD/Q 2eVQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t1TNuSQZxZ97xttq1Z/dNmVsmzVWaeNjVeGrTsRmN60=; b=jYYYrnkjk0Zot10EBZcKdb9BW6mP9vUDco0DxP24LIuhr3TUElmml1y0iXhuLXrBg+ LGa7/Z079g2inmqnMpOZ4tSXyJhK095lwqNmW0vsu2LMjabO2YF5OSX8T9NeE0xtRH9D Pq+1yqVQYaX4FRNHnpqdIcFrYoe1wqJo0S3mz7AvLQkR/XKe3zBLzL75MFGjWPzi/7a4 0NP8AYC2G7dh/K7mvg2xfcDiI7qB09EwCm1z4CXda0WRl6L+Q3PIFhKLbK/u6MDXrQTB Y9OyhiJ0UtK1SZQ0BXS1qGv3T/nPLIByAI46LI8Kw+KKWygWNMIZJ/XjT9awWlmteHBN 73sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0wIJyeF6; 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 g22si12787211edy.163.2021.05.31.06.49.39; Mon, 31 May 2021 06:50:02 -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=0wIJyeF6; 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 S233176AbhEaNuE (ORCPT + 99 others); Mon, 31 May 2021 09:50:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbhEaNdW (ORCPT ); Mon, 31 May 2021 09:33:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C540061436; Mon, 31 May 2021 13:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467467; bh=bPE/bkTwbqPn4/j/eEHApYSL+2En6euIwbjsMON+rxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0wIJyeF6z53yWYCxQb01BTtwL+xysh7HWxAcQ9dYOoIJ7O6K6Q4yTiWOWyrqJsfAz hVuD+B6GyI1h5tGpF5FCVLgaswvpYlnISmSAS7ycp5dc93QAWXsW3PyV0wbgbF/fOS edlqwRwb2fb8gNe4vwaVxyAxZD5R/mUSzT51NFX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David S. Miller" , Dominik Brodowski , Anirudh Rayabharam , Sasha Levin Subject: [PATCH 4.19 077/116] net: fujitsu: fix potential null-ptr-deref Date: Mon, 31 May 2021 15:14:13 +0200 Message-Id: <20210531130642.766712233@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anirudh Rayabharam [ Upstream commit 52202be1cd996cde6e8969a128dc27ee45a7cb5e ] 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" Acked-by: Dominik Brodowski Signed-off-by: Anirudh Rayabharam Link: https://lore.kernel.org/r/20210503115736.2104747-16-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 a69cd19a55ae..b8fc9bbeca2c 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.30.2