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 67721C678D5 for ; Tue, 7 Mar 2023 16:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbjCGQ4C (ORCPT ); Tue, 7 Mar 2023 11:56:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbjCGQzk (ORCPT ); Tue, 7 Mar 2023 11:55:40 -0500 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E2996086 for ; Tue, 7 Mar 2023 08:51:24 -0800 (PST) Received: by mail-qk1-x72e.google.com with SMTP id g20so4664439qkm.7 for ; Tue, 07 Mar 2023 08:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1678207883; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wzr4OXcACBbxsGWAQCIrmAAoBlUBrwvrI9UzEFsGlWY=; b=FOMmZq84ChpnAKLAMSnSR2p2GvuSxzkeDgdo9rw+DurisQbG4ePtpXwc+26HW732La gPzbvKD5jETm2lLW0h40Xa/Gyr9+jzzBYuit2eYjBAtn2CntsQq6HWfjIZnFVwm9TMYU zX3rLNoHPLlaH/S6bOqCOJHXI1HyXlRfouXX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678207883; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wzr4OXcACBbxsGWAQCIrmAAoBlUBrwvrI9UzEFsGlWY=; b=06CXZOHWi16ahhcGmpCdXGhRrRRDbLxRW7CytgQhgXx7YoVybD0smsePjj0qF3EC3A fHD/sOPwqZa/gpdh3/jIRw3wBgrfFnPlkRypGnTG8XvOG0sZ/nPbsgYTOY8lRdm83rBv eG4KUUiK8fWnYRfpJ7bQEnMLs63vkgyp/sv6ktZG3hokT2kMKCfAnTcnvqMycCrGVIDk h9F5eWrIBF69TVVM8gqIgyPZhcdQHe7GEdN4pQmOskDo9U1EmtZjT9hNP7sfQe7ez6Wz H3MAg1+/QSJ9mxEOfzyXvCR0ZLUtXjir6Jcy80VaRlIn565WMiCtF5ARsxQ8PgHT6pMh 6enQ== X-Gm-Message-State: AO0yUKXP4GLHAtz859aXzTOFkZfqRE9s5wzKNyT9+Jt5Pa1bvoiR0osE g2v4E73/iDwJXgkvBqb+1NjwoHDVyPSEZFV8VplXdP66nYwMrf3jOsrpJFl6HLpIxrA4oT+hHfB 8RW4qvoJbMF0aiEtQykEz9cxgWTt40w== X-Google-Smtp-Source: AK7set8ftbR1/dkwgKKBcUW/8aYb9HlBlfhKFqg5/11ekGZhD60vjKL8tCunilmUOP0x+thPWdfhKogRAYGTfrrVQZw= X-Received: by 2002:a37:6514:0:b0:742:9d0f:775f with SMTP id z20-20020a376514000000b007429d0f775fmr3229468qkb.15.1678207882883; Tue, 07 Mar 2023 08:51:22 -0800 (PST) MIME-Version: 1.0 References: <20230225100135.2109330-1-haowenchao2@huawei.com> In-Reply-To: From: Sathya Prakash Veerichetty Date: Tue, 7 Mar 2023 09:51:05 -0700 Message-ID: Subject: Re: [PATCH] scsi: mpt3sas: fix NULL pointer access in mpt3sas_transport_port_add() To: "Martin K. Petersen" Cc: Ranjan Kumar , Sreekanth Reddy , Wenchao Hao , Suganath Prabu Subramani , "James E . J . Bottomley" , MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linfeilong@huawei.com Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000bd77b205f6523813" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000bd77b205f6523813 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 6, 2023 at 6:42=E2=80=AFPM Martin K. Petersen wrote: > > > Ranjan/Sreekanth, > > > port is allocated by sas_port_alloc_num() and rphy is allocated by > > sas_end_device_alloc() or sas_expander_alloc() which may return NULL, > > so we need to check the rphy to avoid possible NULL pointer access. > > > > If sas_rphy_add() called with failure rphy is set to NULL, we would > > access the rphy in next lines which would also result NULL pointer > > access. > > > > Fix commit 78316e9dfc24 ("scsi: mpt3sas: Fix possible resource leaks > > in mpt3sas_transport_port_add()") > > Please review! Looks good to me, please commit it for the 6.3 scsi_fixes > > -- > Martin K. Petersen Oracle Linux Engineering --=20 This electronic communication and the information and any files transmitted= =20 with it, or attached to it, are confidential and are intended solely for=20 the use of the individual or entity to whom it is addressed and may contain= =20 information that is confidential, legally privileged, protected by privacy= =20 laws, or otherwise restricted from disclosure to anyone else. If you are=20 not the intended recipient or the person responsible for delivering the=20 e-mail to the intended recipient, you are hereby notified that any use,=20 copying, distributing, dissemination, forwarding, printing, or copying of= =20 this e-mail is strictly prohibited. If you received this e-mail in error,= =20 please return the e-mail to the sender, delete it from your computer, and= =20 destroy any printed copy of it. --000000000000bd77b205f6523813 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQfwYJKoZIhvcNAQcCoIIQcDCCEGwCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3WMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE A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