Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17231366rwd; Mon, 26 Jun 2023 23:27:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6IV+N5FK+kQv71k0d89bG5o5j6Rjwcddea39wafqzIC2fJMRLTXgsL5IZvMCoagZ8BHhzz X-Received: by 2002:a17:907:a426:b0:992:bc8:58e4 with SMTP id sg38-20020a170907a42600b009920bc858e4mr1143793ejc.20.1687847250081; Mon, 26 Jun 2023 23:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687847250; cv=none; d=google.com; s=arc-20160816; b=vApERUIoeArUsQ/to7j3GpveKHFwSQ4W5gS3tCFhcD9dJX+pdMmiL71fNqd+bwKZfr CCoVPFh8jvG4oLLxf9+In4xUKa5u8rzSvJrZEpi0i06/MWkdQtX8XJ3VS8aVKYS4J6G6 Xq7SJegc7CKGu6Cygn449O2oq6YbJdQTm/D8M3yN2KYMdes9pknqEetaius08237q7ed Aya3qHO4/3YqHjhNJ193BDuewSdDFEpfV6PKZ3fqPGHCS9wNno9UegscCLAxYkvpVAni Nt0NmNGGPFXpfYNlSNpvEHDbs4p58H3RT9GDfiyWNozZrlLIvc9usYQaoOr9NJ/owFt4 pEAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=zYxMIJvRg1Oey3RCMYFyil5GkiXZqz/lRTENon81azs=; fh=1V4/ytyZXyK+pGmK5j1hu6Wl7k0cN9OdbuVQRLzIfnI=; b=jKKBmq2a1LJt22vzmPSOO8S5QUch0iJAhy0eXL1JAYtFt2TXBMo7QCYoiOfD2M1zs5 QHbT0Xztq+e0hgAAMb/JhH/Ifahu3hSEk7jFvpkaZXBWA6Az++FPD9II2fVk6nva2O96 YF1RLHxV/a+zBArPOlExoxU9bAdTrwxa/AKAKCEA54vG0T5qoywsy0UTqeKkD7T6zvON Uaoo+WmlfOyrw3ywDSE+Edj/Ul2bJRBu9s/8l7cX9Orqo1l+mT0QAIGaTBgOP3lJJAl/ UZOIPuX+iK8JVpBRCyY0IABnCeMNL+H/23JZbXI4pYgRFvc1f19fnhVKP/z2kmYFmn+u YTyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="rWw1V/46"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg5-20020a170907204500b0098e3c8c5ad4si2638974ejb.921.2023.06.26.23.27.05; Mon, 26 Jun 2023 23:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="rWw1V/46"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjF0GTE (ORCPT + 99 others); Tue, 27 Jun 2023 02:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbjF0GSk (ORCPT ); Tue, 27 Jun 2023 02:18:40 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6977DE52; Mon, 26 Jun 2023 23:18:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 07B8D215E6; Tue, 27 Jun 2023 06:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687846718; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zYxMIJvRg1Oey3RCMYFyil5GkiXZqz/lRTENon81azs=; b=rWw1V/46zjmLZk5yt5sKpHwFCugNWowccN+igIO8xikiSvedQ/ZCnwX02z87q70HZNSMsM 5ZnnVgT94EILgB1nPHWOlFd349sczFDb1T2f0Hhi1bU7W339+4bXqpqKRvDmA4fJC75k5F pCLyjNZMYev5GgaFBzqsxhIV1nqmwqQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687846718; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zYxMIJvRg1Oey3RCMYFyil5GkiXZqz/lRTENon81azs=; b=bWeUXihaX0NCVcFt5Fd4ObQ4+Z2UzTYexWjkYnFApqEFZaAWhOdFkv6tQNs9lDAZssJHXQ c/35esmV511d3JCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EB71E13276; Tue, 27 Jun 2023 06:18:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8BYcOT1/mmQueQAAMHmgww (envelope-from ); Tue, 27 Jun 2023 06:18:37 +0000 Date: Tue, 27 Jun 2023 08:18:37 +0200 From: Daniel Wagner To: Dan Carpenter Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart Subject: Re: [PATCH v2 4/5] nvme-fc: Make initial connect attempt synchronous Message-ID: References: <20230620133711.22840-1-dwagner@suse.de> <20230620133711.22840-5-dwagner@suse.de> <3ea88e87-9b24-4f7a-958c-97e27d94ec30@moroto.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3ea88e87-9b24-4f7a-958c-97e27d94ec30@moroto.mountain> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 26, 2023 at 02:33:18PM +0300, Dan Carpenter wrote: > > @@ -2943,6 +2943,8 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) > > /* force put free routine to ignore io queues */ > > ctrl->ctrl.tagset = NULL; > > > > + if (ret > 0) > > + ret = -EIO; > > All these checks for ret > 0 make me unhappy. I don't understand how > they are a part of the commit. We have two types of error message types in the nvme subsystem. The negative values are the usual ones and positive ones are nvme protocol errors. For example if the authentication fails because of invalid credentials when doing the authentication nvmf_connect_admin_queue() will return a value of NVME_SC_AUTH_REQUIRED. This is also the value which gets propagated to this point here. The problem is any positive error code is interpreted as a valid pointer later in the code, which results in a crash. > I have tried to look at the context and I think maybe you are working > around the fact that qla_nvme_ls_req() returns QLA_FUNCTION_FAILED on > error. The auth blktests are exercising the error path here and that's why I added this check. BTW, we already use in other places, this is not completely new in this subsystem. > Also the qla_nvme_ls_req() function EINVAL on error. I just wrote a > commit message saying that none of the callers cared but I missed that > apparently gets returned to nvme_fc_init_ctrl(). :/ > https://lore.kernel.org/all/49866d28-4cfe-47b0-842b-78f110e61aab@moroto.mountain/ Thank! > Let's just fix qla_nvme_ls_req() instead of working around it here. > > And let's add a WARN_ON_ONCE() somewhere to prevent future bugs. This makes sense for the driver APIs. Though for the core nvme subsystem this needs to be discusses/redesigned how to handle the protocol errors first. Thanks, Daniel