Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2638453pxj; Mon, 31 May 2021 07:08:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYGuKdSrMlNi+2RGS2y1exksMvF2KnFQSs9scouZAk3yfmu7Vy4fTAM/a57jWwRUPjQeGv X-Received: by 2002:a05:6402:170e:: with SMTP id y14mr17202075edu.367.1622470109493; Mon, 31 May 2021 07:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470109; cv=none; d=google.com; s=arc-20160816; b=zO64+UdDY00JOAciKYPji4bNoHdnAxnmj1x3sLWJgcQzRa+/zNsfnUAiRInA676lC6 N3E5439Ep9WM2Dz6Ziqb6pibI8Srwrj7RI6aisn6527CULzLH94BWumAVh7xYjUhZ1Zh NrQ7Vq5FSWgs5cpPNU4OZsFxK5G7oV0tgN0o45OrSO4obsz0VNm/6+yQGdmReRfCuLhD n1+WxFT0HPnBptX2RyhTySX1qW5GUVaJnZzrMyHZZcLqDiTs3Pk7sG3jKPw5DJefWLjw F/YvoRq6v2FOY+pcwSNozAn1EA/q77fnBCtxysmJXTqo/bJpCtsun+SJVqyvTYq+A7h2 h3hw== 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=OeaDMEDCz5WRVPktWF0jq0lDTX+gtSciYapXjqFPSm3tBdcvcF7AyeW3yujDfRzD+/ iaPPYg4d9arXm5OPA8quKzRortBU8qRvO1UURbMY4fUG9oN1bG9O62x6cKaIifykIgqF 8MoRmClPodyja28LDvx4XbkvibOwydJMMNNMDtkJCCyzH/5CqyY4/u+wP/Vr4xKV+2kC OzK9y9Xx29DInToJA+cl+Pc32iqYvHqFCL9WAjzveeTTTqHmg2mtYYP5EP1wzm0Ks9Ff Jw035BJxZ1ZrLzhFE+fIh3SqK/eZTBzbyZYHirFW4UuzR+K3pENqaGYf/ldnuLsFuup1 01CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xW8kLRSo; 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 hr12si12705999ejc.374.2021.05.31.07.08.06; Mon, 31 May 2021 07:08:29 -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=xW8kLRSo; 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 S230454AbhEaOFz (ORCPT + 99 others); Mon, 31 May 2021 10:05:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbhEaNlu (ORCPT ); Mon, 31 May 2021 09:41:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 824126146D; Mon, 31 May 2021 13:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467698; bh=bPE/bkTwbqPn4/j/eEHApYSL+2En6euIwbjsMON+rxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xW8kLRSomZCxMLMDxK6xEQ97g4i02Q02DW21mle8j96li0IGl6ehMFtDb/zx8It7E /pahmxVMmLQcSHhkqig8nOp/uLu9MRlq2lVcT6byut5esaXlNriUC9GcTih5imnO36 fr9TziXsQkMD9K7Q+23vNIf0uFHp6tJZvhzZ+en8= 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.14 47/79] net: fujitsu: fix potential null-ptr-deref Date: Mon, 31 May 2021 15:14:32 +0200 Message-Id: <20210531130637.519141089@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@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