Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1282441lqz; Mon, 1 Apr 2024 00:40:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgPeggJhGQPFkn0JR5zLBo2wJsPixVDrlWtrnJf66i6+cjWYKbzJ8WCSVmokC2I4p25grFPmiL3eVI8eIAy6WzfOmhXxBvTV2cCynjIQ== X-Google-Smtp-Source: AGHT+IFjP+SQ8M3NLu1hcOFfedx0HeKWdnO08VQGSpb9PsXoofG8QCUS58Z9wHvIuxJ9xFoxXZjP X-Received: by 2002:a05:6902:c2:b0:dcc:9e88:b1b with SMTP id i2-20020a05690200c200b00dcc9e880b1bmr6350089ybs.37.1711957208119; Mon, 01 Apr 2024 00:40:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711957208; cv=pass; d=google.com; s=arc-20160816; b=CUPiiFmh39csoRrwFVbNxOfrRtQiOLaXk4VLicWknEGYX79S7AYFe4CLE9+WD+ehcA ugU0/IIhNHjN/sPnkDwCHzg315t8dDMcS0JRMDPrIO7mV8bMYe3R73tVvW4/9FwN6elR 22eRQlDe/JEe9BlLSuNSAYhGgN/io5L/yGNPtmRpMIWbYiYWe9NZ6eEQGJIXb+huRBHB jNEWJSuWfdwe2vebmec6pT4fwJovhIkr86y8Pv9QrbxwrqgHEKYlSF6Wmt+K88QdBAsk wcfKCbdUBfFdyaM4ZIRGro9qBov1b4A13T36FtGJPxTyaZsvGq2HWqOUo3CaFtzc9eP1 IGNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Ozcn8tivYtO72M9hTtXv8BMvjz9vWsUqFUOs7zGXPRo=; fh=JK/8EOo9qjqrR02UOYFKnuIjgTCbVGwIFiHqSTf4oUo=; b=y26BT+mLJb3AiokbU6fRo5cCY4/dWoucelqmRC3cS3rMIpziuMXlDC2MYrMG74rgpz RUznfq5OCwsbkwfTwaYr8Nnx4DxQAjx9GcSjU4LvyiTbWCdaYXLM+wb3Et3MKhzcSnyf 9io9IRpLzp7T/eHmBKTypbtoMKOaDBmGv+yl+78UG8aCHvWRCjkZqrnx/82QtxGFXfAO zN5/5mb63Wq62An8Zs6JubDVhkIcXq8902LILE/Sj3wOpfLi6RtuhlPjuoCeDyagMGuZ XJRnDxBmILMfWDOrdIDgSA+XXShlZssh2PFQ6V2bsDWSAdqVV7D1n3PcAM9mO9CdiFkj BG7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=usergate.com dmarc=pass fromdomain=usergate.com); spf=pass (google.com: domain of linux-kernel+bounces-126498-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126498-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=usergate.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fj24-20020a056a003a1800b006e6b32eb8afsi8896432pfb.73.2024.04.01.00.40.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 00:40:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126498-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=usergate.com dmarc=pass fromdomain=usergate.com); spf=pass (google.com: domain of linux-kernel+bounces-126498-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126498-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=usergate.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA00D281A7D for ; Mon, 1 Apr 2024 07:40:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BFEBBA50; Mon, 1 Apr 2024 07:39:59 +0000 (UTC) Received: from mx2.usergate.com (mx2.usergate.com [46.229.79.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E32C53BE; Mon, 1 Apr 2024 07:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.229.79.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711957199; cv=none; b=H7dci3k413XzyNzcA287svGFUiRLQeHN40TtrFuN30wjtnDO4VH5lAssY775Y9hLH1/ztU4gi/V1sCG42bLIBNWo7VBuDKIi3SqXY/lX4ne7OOKuorN9F4232DULD55nvtxVBvYr8a1Fdr2X4HsLcK/t/Cx2HTU3Mfv2zjCSKP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711957199; c=relaxed/simple; bh=JHGXCuwlRiOKHMe9gGAfPe04XpwLtVfK25Y8jzuc83E=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=hbgyniXCWiijQMUWkkU3lqYUYsaTraRg0oEpxNeohvf7YbHsemh4YYvtFiEkwsd8zU37PXoT1e1KMoK3JnBNOQymzSojL0S+ts/X6NUIcCHGfJXtuot67DwJlJisF8mXMgClonZznfzy3Hn26LLx6ptzDgcvIORhBOxnCIG7+NI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=usergate.com; spf=pass smtp.mailfrom=usergate.com; arc=none smtp.client-ip=46.229.79.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=usergate.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=usergate.com Received: from mail.usergate.com[192.168.90.36] by mx2.usergate.com with ESMTP id 8961D710E6434F5E801F4A57B177CD02; Mon, 1 Apr 2024 14:39:45 +0700 From: Aleksandr Aprelkov To: Hannes Reinecke CC: Aleksandr Aprelkov ,"James E.J. Bottomley" ,"Martin K. Petersen" ,,, Subject: [PATCH v2 2/2] scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject() Date: Mon, 1 Apr 2024 14:39:32 +0700 Message-ID: <20240401073932.600928-1-aaprelkov@usergate.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ESLSRV-EXCH-01.esafeline.com (192.168.90.36) To nsk02-mbx01.esafeline.com (10.10.1.35) X-Message-Id: 6533A2999C3242938ABFFC4980BF55C9 X-MailFileId: A046C15860A64E06840E91E8E8BF5BA1 If ahd_lookup_scb() returns NULL and ahd_sent_msg() checks are false, then NULL pointer dereference happens Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Aleksandr Aprelkov --- v2: Removed "!= 0" check as Damien Le Moal suggested drivers/scsi/aic7xxx/aic79xx_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 9e0fafa12e87..6bee62224d86 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -5577,7 +5577,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) "Using asynchronous transfers\n", ahd_name(ahd), devinfo->channel, devinfo->target, devinfo->lun); - } else if (scb && (scb->hscb->control & SIMPLE_QUEUE_TAG) != 0) { + } else if (scb && (scb->hscb->control & SIMPLE_QUEUE_TAG)) { int tag_type; int mask; -- 2.34.1