From patchwork Fri Sep 24 01:29:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12513865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D11E7C433EF for ; Fri, 24 Sep 2021 01:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B006E604E9 for ; Fri, 24 Sep 2021 01:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243740AbhIXBb3 (ORCPT ); Thu, 23 Sep 2021 21:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243687AbhIXBb1 (ORCPT ); Thu, 23 Sep 2021 21:31:27 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34EFFC061574 for ; Thu, 23 Sep 2021 18:29:55 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id i25so33959519lfg.6 for ; Thu, 23 Sep 2021 18:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=MQB1T3OI4It7OQOitVxT9q/vfN0GZXtleHPC+c0MnjQ=; b=gjVSGOMWO38OOmxjWTVllfpjuScLCkXJgZ4K8c7Gt8a5Mz5uMb40bQM9EYJtXuCjWG NUQj0J2beyfkC3dskf9+HHoRDV0+zCnK4plfzxNFjwiao6TMcDse+/Ci1Erp9RMkF5tf r6mzh+kL7fkuDyz1GzMURXjtKDurFdccEbQgeGfIe5s9jGV1fEcnrtrDye+6OunYafTt j7w2walhmvdaso1xHjswKXljdhpFMP+zuMdCl9h1p6YPHHrgUaFUCyVY4Ky26xdC9u4q wzoJW0D7GcrQbRyxlBl75ROBG2NhRQdHJ++ocylAX56ytaEamWr1UIyO3ubw3wk++ISZ 7Qug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=MQB1T3OI4It7OQOitVxT9q/vfN0GZXtleHPC+c0MnjQ=; b=uVl13UJSk0BHFFwXxENa1YCHXQ06aQceMFRc8WoBfzvJSzDch4y1rKEXyFMQKTv8Kf 9zz244eY1e2RU736hjSKFE9b4AnE9ebXY0DFgjFRsfntHKO95aVUMxv+c3h3IIaSkhsi Rt8M9eW7vxYcQqhdDdHrjMac4q5Q0dY8ZtXqEAKEWxH3ruHdfi8TyAo+vKZNoZvwJV1M u6KoyVBhc2ktMRhkBL1op3CY2ZfsBDIwv8kBVCpC9CC/cmMhW6rYH3ldmrifVDgicx53 4MuFlqbRlY/05L/2s9cDP8PGkIXW0STEkw78gHJlHnrxP/SB5pYUCbiKatAbquqQ7PGr KLqQ== X-Gm-Message-State: AOAM532t26HQQUNEjfHcRuFXH58Dab/UW1EePLAjGS+j88N+5ly9Rr5W mls4BhbdC4qnpShO7Q4Aru0jzfVz1K+ZrFVgCNt2uETz X-Google-Smtp-Source: ABdhPJwDNOFLXAuP4l6KiT4pBwJhVllYTINo+Do5acNVOcav4BwYsPHBaDzOxbbxuQ9xgDT2XD+tMvjszNnm8gBQYqw= X-Received: by 2002:a2e:1652:: with SMTP id 18mr8395927ljw.23.1632446992430; Thu, 23 Sep 2021 18:29:52 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Thu, 23 Sep 2021 20:29:41 -0500 Message-ID: Subject: Two more CIFS patches pointed out by Dan Carpenter using smatch To: CIFS Cc: Dan Carpenter Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Marked one of them for stable. Both small and seem like low risk fixes. See attached. From 56134a0432710af1ec48e4bd1ced5ecd11260cb4 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 23 Sep 2021 19:18:37 -0500 Subject: [PATCH 2/2] cifs: fix incorrect check for null pointer in header_assemble Although very unlikely that the tlink pointer would be null in this case, get_next_mid function can in theory return null (but not an error) so need to check for null (not for IS_ERR, which can not be returned here). Address warning: fs/smbfs_client/connect.c:2392 cifs_match_super() warn: 'tlink' isn't an ERR_PTR Pointed out by Dan Carpenter via smatch code analysis tool CC: stable@vger.kernel.org Reported-by: Dan Carpenter Signed-off-by: Steve French --- fs/cifs/connect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 7881115cfbee..c3b94c1e4591 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2389,9 +2389,10 @@ cifs_match_super(struct super_block *sb, void *data) spin_lock(&cifs_tcp_ses_lock); cifs_sb = CIFS_SB(sb); tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); - if (IS_ERR(tlink)) { + if (tlink == NULL) { + /* can not match superblock if tlink were ever null */ spin_unlock(&cifs_tcp_ses_lock); - return rc; + return 0; } tcon = tlink_tcon(tlink); ses = tcon->ses; -- 2.30.2