Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2707351pxj; Mon, 31 May 2021 08:44:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcOvF+4q6aJdHHk1z1KyRQmb5qYrlBqBu7/7cVnC58HXJNPpMYb8pxtDnHxuKvKjn5+JUN X-Received: by 2002:a05:6602:2be7:: with SMTP id d7mr4042145ioy.143.1622475866774; Mon, 31 May 2021 08:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622475866; cv=none; d=google.com; s=arc-20160816; b=R/QZZOBeFBGIWfPlSS0s68jChfuNAh5hYwfqjbJsCpifHw4fXyKSrV0Ed9bKeU3EZq HOOo2KoXoSbEHpe4n8eYWTwX8M7c7sBMhYEe7kmaxiaWnPj4r3ziSD9vwIbp7Tnh1+im e7pYxIQRd6Ydj4srlgsu7il4g3gtfS3yy7uA73jSCnUib93PtmdlWVO6J9VeQiVzdhGt DPpcUdgpUVhaGmcSGWKUJc/n5VhWRkvb7EMW1aZFR1i5NMYkjmkLrm0rL6uHaZw+qzV+ SOwL/FB4ShjbwhxVN+MqdnPxMcuu1AQb/Q5/SAHRYV8D6pv6wKGzzCggRzRvgXW8PBOr mBzQ== 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=NKFneN0Fi3xGqBHPBQY8GmddIr3/dm+k6atW1ID8WUgBeFuvmb6uYUV160B6Jp8mwt KgQP4eQmMWiEVzcX32wVI+LNRAw7hIHlC3KoMcsq+rtL/RNLGSrBIiekoHznzq745F3n AaOp1U/JROyVFSyt/PKbz4zLMs/uN/OYZnj5u1CpeejpCj+o4eEGi4rTSBhB+pplsTug KDV8Irp9cEicmNlPulFhunaiJJA6DFkY/11doOpOrwKvRuoTN3wi1vuAPgjja64JIdIc 3iKpN7teUl2EeqwbHrP4B0C4T8pMohD5uDTqIneEOmaYXQ7AkvJoOanWFjYOfFmqrbJ1 tSvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vAYq1fgW; 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 u15si17355467iot.55.2021.05.31.08.44.12; Mon, 31 May 2021 08:44:26 -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=vAYq1fgW; 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 S234441AbhEaPor (ORCPT + 99 others); Mon, 31 May 2021 11:44:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:48844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233670AbhEaOZV (ORCPT ); Mon, 31 May 2021 10:25:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8C91615FF; Mon, 31 May 2021 13:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468787; bh=bPE/bkTwbqPn4/j/eEHApYSL+2En6euIwbjsMON+rxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vAYq1fgWwWehEEhxGrxtdOho52kY3MDDLwmaPRrsd98HHlOcO/rzUAtmvUzWD7i7j FZmQurVIjGYRU1OYiPHv2uwCNG4EdOQCdUM6xESQVfc/QkhzDbvKiC5v/8vhNlgvWZ 75IkseIHckop2n/k5BZpTrKJfKppgnqzTQPF0dfU= 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 5.4 093/177] net: fujitsu: fix potential null-ptr-deref Date: Mon, 31 May 2021 15:14:10 +0200 Message-Id: <20210531130651.104259456@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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