From patchwork Wed Jun 23 01:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1495888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=t0ZGr7xR; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G8lkk4Spmz9s24 for ; Wed, 23 Jun 2021 11:18:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbhFWBUV (ORCPT ); Tue, 22 Jun 2021 21:20:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbhFWBUU (ORCPT ); Tue, 22 Jun 2021 21:20:20 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173A9C061574 for ; Tue, 22 Jun 2021 18:18:03 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id p7so1323009lfg.4 for ; Tue, 22 Jun 2021 18:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=07FgMVo6gbZ16ocf7Rsp/dQ4TFHeb86K0zNpFrg/quU=; b=t0ZGr7xRMrF2oIengY35iXBGWFzBt+ueM3w51Dnalesg0rFsZL2Qv4tCbvn+LMlmzU 44s4Xhl09KyKSYsYMvVUSyt0FjVbQTL+gy2bMMdT6SNqDCnOFlLWQy+Uhj2/nUqZMJ19 OWO7uV8YkRA+uvcMAMk2uYZadkIRaNNxyGFddSQwlmU9341nevn7+sD5ddQmfLneXxMO 5DP2tcZ9MjH9WigehImJ8XVsGoq/EGTX4aEDX6d2FuSSpt78S6U9F+FaJ65WIm5ZosZY tgBrA9o8TG567oH9BkSjbU1ODEYmFU0pJFPZRqEGQC6TMqhY6PM5P0kW1VMSYocaUfRn kk3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=07FgMVo6gbZ16ocf7Rsp/dQ4TFHeb86K0zNpFrg/quU=; b=Sd/XJWHMd/mTAXI1fhj0kPCictKyPvcLrZP/CWVgfiXIW0hP++JqE4EGR/ILWvXRuL L4hQbDzWpMniDGgBLUqloNCsDhGU+oCUNi8lGmfSY7J7CZVyzkqhO1SEf6m99U0bejbQ PHNW+VxtqRPHVkmTLYHg7jAorBWErVggWaftQmTONofeh14Ke6g9t3txiAVfNE1MwUhO vEWhGEcv7ehBK/wfD7CiOZbtQlRV1FPi8pMHe5Ba8bJjSw2q2GcDUjWSRS7CqbdLto98 OoULYGBnm+zCfTws+nj7lKRbVG7IQ5lfquFOO9p6Od0WpCeiRI+lkqWdMG4NVfPWlCUV Uc/w== X-Gm-Message-State: AOAM530+UBfw/crRWZk7bSDXqxMSSDR36vefCwZ8fL0eR5t+8SSePGEz TnkcTfyt0TgzSSdZBOgt1yUrpgdtGmzvPx7PwRUJl7toOmWqwQ== X-Google-Smtp-Source: ABdhPJw5JIuUdl/XgRzme7sbDzEeYgweu9+v5bZrsTyWaeRsCnvgN+6oZxvqgnVzDk4RFDeXshGaEbGRXok+IzQKUEg= X-Received: by 2002:ac2:419a:: with SMTP id z26mr5024151lfh.307.1624411081257; Tue, 22 Jun 2021 18:18:01 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Tue, 22 Jun 2021 20:17:50 -0500 Message-ID: Subject: [PATCH] cifs: missing null pointer check in cifs_mount To: CIFS Cc: Paulo Alcantara , ronnie sahlberg Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We weren't checking if tcon is null before setting dfs path, although we check for null tcon in an earlier assignment statement. Addresses-Coverity: 1476411 ("Dereference after null check") Signed-off-by: Steve French --- fs/cifs/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) From 632096b66b2fa2621e3d2d02c2c2fd436975810b Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 22 Jun 2021 20:13:44 -0500 Subject: [PATCH] cifs: missing null pointer check in cifs_mount We weren't checking if tcon is null before setting dfs path, although we check for null tcon in an earlier assignment statement. Addresses-Coverity: 1476411 ("Dereference after null check") Signed-off-by: Steve French --- fs/cifs/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8d95607a9312..196ef9ec69db 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3480,7 +3480,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) goto error; } spin_lock(&cifs_tcp_ses_lock); - tcon->dfs_path = ref_path; + if (tcon) + tcon->dfs_path = ref_path; ref_path = NULL; spin_unlock(&cifs_tcp_ses_lock); -- 2.30.2