Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472029pxj; Mon, 10 May 2021 03:56:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1yI8DVMmworb4JYJK6IBeBGQ3ue17Tp5C4bJv43RSjzmiVVAICPlZxVSaHS7RrraemZ5c X-Received: by 2002:a05:6e02:1708:: with SMTP id u8mr21816967ill.188.1620644206735; Mon, 10 May 2021 03:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644206; cv=none; d=google.com; s=arc-20160816; b=dsjPrqnhM9Fl8hcF84b+PwNLF7cm7Yc2YlI52LyzJN7C99KV6aSlfjp+xiCycQ92ry nwlARWoV+ekUzJaYW7vS/ZwMDgZEOEKKJSx1SnbJlT+0eNMKt0GNSjjxNJQDTfA8ouu0 DjV5sxUGFU6b5vml0mOSixIz2f4CqVNjdRwwS9yf6/qE7W6F8W5kVQP/s0U9Wnc5WWQE nzKJr/TFjQas9S7aQCHi+Ci/ycIuZcTwDh7e9j5zQQsRWphfnitiV29as6J95AlFGSqQ oQn3JU+xB8uLVxa4cldIJKEm3w1yxqk/GczckdlNsEiIfvv4hfPngxVWCANFCXWRpr3b HmLw== 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=WgufETu8TVorEWnlCfoBPdeSCBHlZijQDkLYi7ZKKPI=; b=ut8lwhTH0IaVYMCzNXPwCxc6fW4yi+uW1/jra6h/OAaL49PCyVc6DriKJbPVsUd00J sKUYqnk/MtNk0CusKI7DJtEv3hZNzZ4GlMmk/ijJERp0KkrFNIo/CH3obj9pvKb4MVv6 zjtB9kk/F9PSB7WRyRaJ7ccXjxlMKKkZHmS0yt4LN23sbtktn+JsqpJiDaXrfGTkFm5O BJoYGJFWOwhAeppYxRyEHwDGfIvLbCnVzr3AQQuzF9/HukIw8RiG/YOzGbie/hThrTVE 7SO09FCc43vd/0PXsfoPg88uLUtRVxEUEqjNPhP6IdRswLlplf8bLmSA9zTWpEvuCWJ+ fqfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OibW7Aps; 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 h27si15766917jaq.100.2021.05.10.03.56.34; Mon, 10 May 2021 03:56:46 -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=OibW7Aps; 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 S233041AbhEJKwA (ORCPT + 99 others); Mon, 10 May 2021 06:52:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:48222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbhEJKl0 (ORCPT ); Mon, 10 May 2021 06:41:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 11DE161972; Mon, 10 May 2021 10:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642727; bh=/z5dTUJjzmVUsgl8hevEc3fL8woqrdFfRIFbIj23xeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OibW7Aps9yaOHrx71PqBEHQOtyQ/gfW0FGQFt64yz56kqsIf6u79rFHYufW8jvmVh fCSd2hLNofRWS646eU3wsgvSj7tRX8cMccWCtcarFsmgkKqb9u+OfSs0e/9/VoMNrS 1/xQw73zPDzegPFUOT0zvOJIXHFHnZTgI4VT5xV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurence Oberman , Dan Carpenter , Himanshu Madhani , Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.10 026/299] scsi: qla2xxx: Fix crash in qla2xxx_mqueuecommand() Date: Mon, 10 May 2021 12:17:03 +0200 Message-Id: <20210510102005.713431021@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Arun Easi commit 6641df81ab799f28a5d564f860233dd26cca0d93 upstream. RIP: 0010:kmem_cache_free+0xfa/0x1b0 Call Trace: qla2xxx_mqueuecommand+0x2b5/0x2c0 [qla2xxx] scsi_queue_rq+0x5e2/0xa40 __blk_mq_try_issue_directly+0x128/0x1d0 blk_mq_request_issue_directly+0x4e/0xb0 Fix incorrect call to free srb in qla2xxx_mqueuecommand(), as srb is now allocated by upper layers. This fixes smatch warning of srb unintended free. Link: https://lore.kernel.org/r/20210329085229.4367-7-njavali@marvell.com Fixes: af2a0c51b120 ("scsi: qla2xxx: Fix SRB leak on switch command timeout") Cc: stable@vger.kernel.org # 5.5 Reported-by: Laurence Oberman Reported-by: Dan Carpenter Reviewed-by: Himanshu Madhani Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_os.c | 7 ------- 1 file changed, 7 deletions(-) --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1008,8 +1008,6 @@ qla2xxx_mqueuecommand(struct Scsi_Host * if (rval != QLA_SUCCESS) { ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3078, "Start scsi failed rval=%d for cmd=%p.\n", rval, cmd); - if (rval == QLA_INTERFACE_ERROR) - goto qc24_free_sp_fail_command; goto qc24_host_busy_free_sp; } @@ -1021,11 +1019,6 @@ qc24_host_busy_free_sp: qc24_target_busy: return SCSI_MLQUEUE_TARGET_BUSY; -qc24_free_sp_fail_command: - sp->free(sp); - CMD_SP(cmd) = NULL; - qla2xxx_rel_qpair_sp(sp->qpair, sp); - qc24_fail_command: cmd->scsi_done(cmd);