Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2665094pxj; Mon, 31 May 2021 07:45:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAMWgoJ9auFDryyPUFDvXtPlD5tbwbxcXHCVFmdZjPszga4szMOy+aJwFKCi6mOpxQXy7O X-Received: by 2002:a17:907:779a:: with SMTP id ky26mr16169058ejc.293.1622472358190; Mon, 31 May 2021 07:45:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472358; cv=none; d=google.com; s=arc-20160816; b=dRmklYQSrVIPdPfoka1VCnb33MDlqtPLNKj0+yw0hEprU/80zcWz8/jHPPe/Bb/YUj k1KvUnL5hAoUTf3wpOttg5cYZBQoSUwV63v43grG0unAlkSFRQD2/u3ON5fosP9a/swg bwGdWBi+Pb0Kx82b4i1VN/e9XqMWL6MjXamOIUkc7UFV5ORaQMOeRX4BtK2JFlbVJu0I RhrCk+2lysjW7jifL39r3KIrgpPKWbnJNFShYxv5LeUW7aOfzYbivYmrMxKer2a+qL5Y GYaJyIRF/cBIpw0rSc2wEr+ypg4yy4lYHwT9wkFBQ2JtsTQEIH2joU2olSK4x2IEClF3 RsGg== 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=o62AEvj1/UvQ6kTZKvl6lJQJP5ib2wueQb4sLEbo5V/bKx39VbiLOupIuOUUciiZFY 1cxhv6xiM6RrxBAFcV423azWhS7qzOX7/CoYtJ4wdBIwxx3qFwO9nk07ZYsMW3qN8eoO 7QZP16N4xuM+hJwXLb8pMkWpAbOQb7VfvEb6fN2HKpld+kV6P4mNXWmp+6m4NW+JdbfA aPWBhuo1vSeXFOsSyHBcC+V5HHy+2Hidt3LhE2D4EZnzDXwx5ELZXQQ51PaiKf3rX5YF uXGva3z5v708aGQ7WoNzJ5XgSfbquDSqo+CJdhMXUNm6uoTfMqwwcwogBmi1mjLAOsFD 9K4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LOVW51t1; 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 cd23si12168201ejb.712.2021.05.31.07.45.34; Mon, 31 May 2021 07:45:58 -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=LOVW51t1; 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 S234146AbhEaOow (ORCPT + 99 others); Mon, 31 May 2021 10:44:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:59856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbhEaN7U (ORCPT ); Mon, 31 May 2021 09:59:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFB7561933; Mon, 31 May 2021 13:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468160; bh=3Dbt6QMFQJ+5uUFwcM6yTQ8Yvxyht9pncCIVnfvtdLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOVW51t1lletf4/uvL0M6+Lar+Piw40i1UWb2bLKJ9YP+xwmDHO5sbtCMszHgdAaI O0D3spOHB6vmaWGhZnFwmVmYoVBxTybGYRhWRb3ECocafpq09M/5caMHbb7pNPXD+A fKQIhaN26wRt0hFYizDAJ6rZk4x26ZmHEHv+CcTA= 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.10 138/252] net: fujitsu: fix potential null-ptr-deref Date: Mon, 31 May 2021 15:13:23 +0200 Message-Id: <20210531130702.703959552@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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