Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2739508pxj; Mon, 31 May 2021 09:31:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+0XPLfn5g8Y3/nGaUI0vtdS6mkubEaCtx/OIfy3RuqcI9MrHs9BweH5O6YvnjITRD+K93 X-Received: by 2002:a05:6402:5241:: with SMTP id t1mr26134145edd.161.1622478704526; Mon, 31 May 2021 09:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622478704; cv=none; d=google.com; s=arc-20160816; b=dLjTDisFAmNbbv7eVHztChhaEuAgyRwis4quGF0pTfmipNWvla3RWdTAJhUuHBOSJy eBBjSr01V/sHnTzx2R4S0lOwIu2uLzsZr/z/HOV6GcS2F1pnRBMO/TuOO10zm5BPyt5W jPbFNCWVsaNG7yBTbZoivODEhGy0b0B5vgwVLFYzReihJ+m7umSxh0hD7uc4bBvHhf3D ztNFT0vxj00VDK+D9rYu/E0GvuZPUUmm1/fphIR21dfp4MH8uJuts1mdocWyg9ST5t2g G2kcsv3YlXSz3GL8Ao/YbHDtUOmRX5jRtiN6GvzEED2rHwNnF/s23a6x7n/KXKxcjdD6 VqkQ== 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=L/koz74uGedY0q2p3a7d6IBLBKuOJeTrRoOmjMpej3s=; b=WPk/u45SImcLk4BtwAQXZHUbXNH/ay/DRpxlWJ+xzi8l2yvBQHG5n7FPQ1wVyD4G4v ZemdfeuOO+Umu1BDq4uzx3Iyr/00rfQPXLFDE/mMt7BCyWByPscIhC3hCFUr+CSVp6O7 PFTp+bwLEkvIkoe0zwuxC0minItN7i1R3tePicQTTKltNfyYSPKaa+W+8ki9uQM5p/i0 I88MBHCsyf9lWScSs6X7vmPcooleYdZ33mWeA57uir4v1DKSBFpbIcGkANWe0YnpS/jV XcsbW8Zdm/7evclVEbVSarunOH5SmhG0rzgL722C6r6yXbXipLtUKrG/ysnUZpwfl6sS jAUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M6GTGPag; 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 cm6si8178674edb.511.2021.05.31.09.31.16; Mon, 31 May 2021 09:31:44 -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=M6GTGPag; 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 S232784AbhEaQbq (ORCPT + 99 others); Mon, 31 May 2021 12:31:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:40314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233407AbhEaOrL (ORCPT ); Mon, 31 May 2021 10:47:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 582F961C8C; Mon, 31 May 2021 13:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469362; bh=3Dbt6QMFQJ+5uUFwcM6yTQ8Yvxyht9pncCIVnfvtdLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6GTGPagpHG1mjQJ5V9a4R85lMU215KEoG2NcF9+Pi+zMFapQKTgWFabKfJkTCHKc pQ4Pv5l9g64PiDyAxy7OKVvecDRyh5maKxL3TMGsHQpP1LaJWKIoT31b3/tuwCmEGO aTJCdc8mDRcaYxT9PIZFiCQviZBbDkdrXWPK8RyY= 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.12 168/296] net: fujitsu: fix potential null-ptr-deref Date: Mon, 31 May 2021 15:13:43 +0200 Message-Id: <20210531130709.515440493@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 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.30.2