From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54FE9C43219 for ; Tue, 30 Apr 2019 11:58:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 268462173E for ; Tue, 30 Apr 2019 11:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556625500; bh=SrJCoBMwqCwlPKloQA39AOKmQbx9IOxoVdnu2uvxb/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xwWZQr7tVLBIxu1oujRoi/Vs33O1CuwrWEciQVRVyG7R/prTVtpHh31ek9wAfz5HJ DiKuOLhyu7rfaJ8TIiWm5LaN15gqT9gNymH4R9qhPjTN+VjSEnToCYeMh5btJz4Qyz FICBixQ1aRKd334qeq6AlsEr6X1cSwU2jz4hc8EM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbfD3L6S (ORCPT ); Tue, 30 Apr 2019 07:58:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:60754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730687AbfD3LrQ (ORCPT ); Tue, 30 Apr 2019 07:47:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C850821670; Tue, 30 Apr 2019 11:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624836; bh=SrJCoBMwqCwlPKloQA39AOKmQbx9IOxoVdnu2uvxb/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1puJMnOg3hcAViHJoT++RD4JG7Z1OrBwrhX6CnkYqvmYRsGYhYAfpi5huON7lUnO ciGOOb/DrTGu+47BPRwDh24tZY2gGflvai5N7bn/P13um4cbPgjpJHzQVKmWzw9uY4 w32xluStqjj548CKe1YeEP7vAn0JffX60F0yHnCI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Shishkin Subject: [PATCH 4.19 053/100] intel_th: gth: Fix an off-by-one in output unassigning Date: Tue, 30 Apr 2019 13:38:22 +0200 Message-Id: <20190430113611.474614031@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113608.616903219@linuxfoundation.org> References: <20190430113608.616903219@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Shishkin commit 91d3f8a629849968dc91d6ce54f2d46abf4feb7f upstream. Commit 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs") fixes a NULL dereference for all masters except the last one ("256+"), which keeps the stale pointer after the output driver had been unassigned. Fix the off-by-one. Signed-off-by: Alexander Shishkin Fixes: 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs") Signed-off-by: Greg Kroah-Hartman --- drivers/hwtracing/intel_th/gth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwtracing/intel_th/gth.c +++ b/drivers/hwtracing/intel_th/gth.c @@ -616,7 +616,7 @@ static void intel_th_gth_unassign(struct othdev->output.port = -1; othdev->output.active = false; gth->output[port].output = NULL; - for (master = 0; master < TH_CONFIGURABLE_MASTERS; master++) + for (master = 0; master <= TH_CONFIGURABLE_MASTERS; master++) if (gth->master[master] == port) gth->master[master] = -1; spin_unlock(>h->gth_lock);