From patchwork Thu Jun 17 17:36:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1493775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G5TlG424Fz9sSn; Fri, 18 Jun 2021 03:37:14 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ltvwz-0004sD-T5; Thu, 17 Jun 2021 17:37:09 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ltvwo-0004fx-Ii for kernel-team@lists.ubuntu.com; Thu, 17 Jun 2021 17:36:58 +0000 Received: from mail-pj1-f70.google.com ([209.85.216.70]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1ltvwo-0004fT-7Z for kernel-team@lists.ubuntu.com; Thu, 17 Jun 2021 17:36:58 +0000 Received: by mail-pj1-f70.google.com with SMTP id gn6-20020a17090ac786b029016ec962b449so1608946pjb.7 for ; Thu, 17 Jun 2021 10:36:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KBn00I9AD78FH3MyMRBQlhghJAMxHqoJZZ0Q1XSGr54=; b=qDAB0vQLeZdYJ3SBEjBY2aWVYNkSayIZIXa1jo5ZVD3tRJpBwLIv9NrMUOGLCEGRvd VZyXgR8ZbUK2qOPxfBIugtRorIg4IFprUnEI8mfE6OmiGvIZXEjl0rWH0FbHYpeXSnCS e1ZdvYUVWQlHw9a77jSRkXnfWcusYGWGlWyQbJKj+TRI1RcI6H0uBQSbnNs05gzYLite Rd97c0vCQXW35EN1ygEnYT/b2WG0TXvyng8hX+4d7asgR4Y6legOIC0gNYAD3nfqP66V yokFgh772yNoXsingbs1K9hnOVzH9VE+G2R3I34BX5YA3CmiZ/9NqHho3y7f6QAaKkZj nxEg== X-Gm-Message-State: AOAM532+073cCuVG9n1CIOqPDP6YhaYxC7b3UkGz+1VQwloRlf1Kk7Zy hr5lx3blYJSELFSb4ts0vfEQZ3aF80to54uKxBejcApyBNJ7yY2ahwfZDp33TIDYmPWoPx6IjFG AIrFeAVz0aBhVPdWRjh66Uf44Fx/Lf2CoOGvQoqghsw== X-Received: by 2002:a17:90a:b785:: with SMTP id m5mr6698523pjr.51.1623951416440; Thu, 17 Jun 2021 10:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys9qxFTRU/lxns8FFTUrL4Hrnyvtn8F9PIYfR2RPyO6atqd+SX5pKEe7NXBvFaNocQrt466g== X-Received: by 2002:a17:90a:b785:: with SMTP id m5mr6698508pjr.51.1623951416241; Thu, 17 Jun 2021 10:36:56 -0700 (PDT) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id e2sm5725821pfc.135.2021.06.17.10.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 10:36:55 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/4][groovy:linux] cifs: Avoid error pointer dereference Date: Thu, 17 Jun 2021 11:36:44 -0600 Message-Id: <20210617173645.25868-8-tim.gardner@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210617173645.25868-1-tim.gardner@canonical.com> References: <20210617173645.25868-1-tim.gardner@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Samuel Cabrero BugLink: https://bugs.launchpad.net/bugs/1929831 The patch 7d6535b72042: "cifs: Simplify reconnect code when dfs upcall is enabled" leads to the following static checker warning: fs/cifs/connect.c:160 reconn_set_next_dfs_target() error: 'server->hostname' dereferencing possible ERR_PTR() Avoid dereferencing the error pointer by early returning on error condition. Reported-by: Dan Carpenter Signed-off-by: Samuel Cabrero Signed-off-by: Steve French (cherry picked from commit 0bf1bafb17df03fbd0e8b9a086c39e6f24af7193) Signed-off-by: Tim Gardner --- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 21f60450682a..cf690edd1b4f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -419,6 +419,7 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, cifs_dbg(FYI, "%s: failed to extract hostname from target: %ld\n", __func__, PTR_ERR(server->hostname)); + return; } rc = reconn_set_ipaddr_from_hostname(server);