From nobody Mon Apr 6 00:31:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A724DC6FA8A for ; Tue, 13 Sep 2022 14:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233227AbiIMOvF (ORCPT ); Tue, 13 Sep 2022 10:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234366AbiIMOsj (ORCPT ); Tue, 13 Sep 2022 10:48:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD12A69F4D; Tue, 13 Sep 2022 07:25:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B65E0B80F3B; Tue, 13 Sep 2022 14:23:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35C86C433C1; Tue, 13 Sep 2022 14:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079032; bh=DXF54WQlcK/aA3dHJYwUJ8ZCOz+KS60hmD4fshTAbLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EI26L6lbjmjejlLkS9UaPiAgXyfIj8dObayfzEBReThHrUQtfP6x+TUSsQQVjzlSI N10+gY54lE5nAAWVho8LWjNxvYUkywcKy00Y8PmY4mpkzEjnOPEyVjalwgpHd7ulBw RpvlYA+w7v4NVCnUWXHe+oS4eaWq5rQlNAkXY1YA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sreekanth Reddy , "Martin K. Petersen" Subject: [PATCH 5.10 31/79] scsi: mpt3sas: Fix use-after-free warning Date: Tue, 13 Sep 2022 16:04:36 +0200 Message-Id: <20220913140351.803187957@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140350.291927556@linuxfoundation.org> References: <20220913140350.291927556@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sreekanth Reddy commit 991df3dd5144f2e6b1c38b8d20ed3d4d21e20b34 upstream. Fix the following use-after-free warning which is observed during controller reset: refcount_t: underflow; use-after-free. WARNING: CPU: 23 PID: 5399 at lib/refcount.c:28 refcount_warn_saturate+0xa6= /0xf0 Link: https://lore.kernel.org/r/20220906134908.1039-2-sreekanth.reddy@broad= com.com Signed-off-by: Sreekanth Reddy Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -3501,6 +3501,7 @@ static struct fw_event_work *dequeue_nex fw_event =3D list_first_entry(&ioc->fw_event_list, struct fw_event_work, list); list_del_init(&fw_event->list); + fw_event_work_put(fw_event); } spin_unlock_irqrestore(&ioc->fw_event_lock, flags); =20 @@ -3559,7 +3560,6 @@ _scsih_fw_event_cleanup_queue(struct MPT if (cancel_work_sync(&fw_event->work)) fw_event_work_put(fw_event); =20 - fw_event_work_put(fw_event); } ioc->fw_events_cleanup =3D 0; }