Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp453579pxj; Tue, 18 May 2021 07:08:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpZKk+ragv3Kq25I/W3eo6e+eW6V9L6YD3a5N2UNefI9u2LnnhbHSp/t0ZEa3Ok4a/ZRY3 X-Received: by 2002:a05:6602:2bdc:: with SMTP id s28mr4208538iov.102.1621346886708; Tue, 18 May 2021 07:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621346886; cv=none; d=google.com; s=arc-20160816; b=aH1en4uaSAJqP+/MBXFpfJQUzVhOiobFBBe9b3glCz0h9/G6Vxw29wGLui9HVd+I36 acGHaSGNJSitHfSEtOkcrm+VDZfTr5WBGjfvLZvOpomA34Gy5XlXbKD1ehf9ymnx4pDP y0HZTjTSqUFr8fvW0QS48cgpC59u7MosATV+qOED5RYCEi+K1OHcRn7Tq12BDbaCjI8I TsJAMQCVP6KyXjw6NLDrmWUpTKDUFRJixU8csWKc58UjI93WdvgaPnLGpnOEC+Waplmw RKj8wZQgTr5MDkTGNQCwlk7emeMRWgGDbXOSLn3tu7rjSsWaZ2mV3zvwYgTNEmPlAWwQ uS5g== 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=Ph2h2rXG/6LOa7EWE212wqu9T1vz3WilBUkiLncjUT4=; b=qagoiS49A8uEFnAspStySalI2Mhr7yhB8vzuFBLl9MSgrfR4UNBw1WzmqF1Z2Pj4Su AylHWnElJPcvNfrD/hlVFpX5PNzmpgZPAntAuMJ5CuhGmAXjDBfrQzP4nzPvd5lbo2/a g7RL0Ayy93KDrtRmxk8JlKVWO08QFcKogpYORP/8hD7cvLqCihMRDHlQExmAVWhuCEqE 0vzjCwXA5mTRcRR8d255jeekEs12lNkL1jNIzZCq//YgTpehl012QIhUosKxBU0H6ZKY JS52ln+8tEN20CsIxkPrs4BhX8WmUs0eLfsC+yb7BV6mcXdkv7GMVHBf4FzgfQ0KgmaG aw7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PSdWxC0L; 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 15si23068134ilz.158.2021.05.18.07.07.53; Tue, 18 May 2021 07:08:06 -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=PSdWxC0L; 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 S1343606AbhEQPl1 (ORCPT + 99 others); Mon, 17 May 2021 11:41:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:41300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243904AbhEQP0g (ORCPT ); Mon, 17 May 2021 11:26:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A95DD6101E; Mon, 17 May 2021 14:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262193; bh=WigA0s0Qf+Uvz3qLM/a7I0FAlGbfIRPrRCmCmQAPl78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSdWxC0LBuPAdzq03OqzamK2EEaeuvnfWUv4OUfTaf+rfMotbbrDU7Djva08iREBd H/h0KcUBeKBZQGd2nti4ojszp9r54Z79xaGolyn0vlHleoGs2L+unoMdezCPfW7RVu C5xqVZXKxb15AUUAP47SB/OWiAtzG0lY0zDaMXi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Dave Jiang , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 130/289] dmaengine: idxd: Fix potential null dereference on pointer status Date: Mon, 17 May 2021 16:00:55 +0200 Message-Id: <20210517140309.535466038@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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: Colin Ian King [ Upstream commit 28ac8e03c43dfc6a703aa420d18222540b801120 ] There are calls to idxd_cmd_exec that pass a null status pointer however a recent commit has added an assignment to *status that can end up with a null pointer dereference. The function expects a null status pointer sometimes as there is a later assignment to *status where status is first null checked. Fix the issue by null checking status before making the assignment. Addresses-Coverity: ("Explicit null dereferenced") Fixes: 89e3becd8f82 ("dmaengine: idxd: check device state before issue command") Signed-off-by: Colin Ian King Acked-by: Dave Jiang Link: https://lore.kernel.org/r/20210415110654.1941580-1-colin.king@canonical.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/idxd/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index 459e9fbc2253..f90fdf7aeeef 100644 --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -378,7 +378,8 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand, if (idxd_device_is_halted(idxd)) { dev_warn(&idxd->pdev->dev, "Device is HALTED!\n"); - *status = IDXD_CMDSTS_HW_ERR; + if (status) + *status = IDXD_CMDSTS_HW_ERR; return; } -- 2.30.2