From patchwork Tue Jun 22 23:02:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1495873 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=b/59NIox; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G8hkJ2Ycbz9sVp for ; Wed, 23 Jun 2021 09:02:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbhFVXEr (ORCPT ); Tue, 22 Jun 2021 19:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbhFVXEq (ORCPT ); Tue, 22 Jun 2021 19:04:46 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCB5C061574 for ; Tue, 22 Jun 2021 16:02:29 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id f13so380809ljp.10 for ; Tue, 22 Jun 2021 16:02:29 -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=c/ruWRnwSmVfnqBUYQrCozS8iPWLOvHZHnppNj8oZ2E=; b=b/59NIoxgtJOpJjkJK/GoBNvv7o5kr82U3HB/5o+11SNC2mOhe53pA6LCJmyyel1j8 wZ9rmHFiMiloPxoCRVrwGhoRPUfqxbDRI8Ev0gCYXzfc4/R6ahETSBTqKFYsfzMkFs2M hNttSK5XKodIJP594/YxL6srTFA5rQOK1YCTE3uD6Wy/NOWYPPtsGtSOEq5ceP2iuNHS WDisaSJJjS3Yamz+L8xC193upThQElli4+6E1/4RBYxvLMyWeqxRc/MN2GDsEYL1jPTL 5/MR92yvyasCDerI3+KDAQN7YXyHARK+slAG4SR255w3BANQuAEUeGHVSkM5tE5OxAdm Nbzw== 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=c/ruWRnwSmVfnqBUYQrCozS8iPWLOvHZHnppNj8oZ2E=; b=E8qS9BLhPdoab6FYWbJVeWvsnZjLa6S/YGXakJyPf6o+GFSdMXvOiNNHEnp5TZ3frU Z1rux9Qn4D8QY+I16iZ1apaMOwBziCsQtsxzen/36CD/zTaa54Gex43dj1VFueg5ZXN2 MYnMLvtu5TdseXWTIzwKGJVFpCjmsgB4YVhzUL1gKKYWbpyH7ZnW58MYfkVyGXQpc1EH NOYFuMNKhet52FBEAqAJ7GnKuhELuDTd+96+jf0g3yE4u6/pGB9QgEQGP9F6OaI4LVVb eUXpQ7yVhDkVrI1yDb0KXQC2nYbv/AaFhD70PFubUFzFLPzvZy92w9sr1cxAy5jF9Twi 4HQg== X-Gm-Message-State: AOAM532PUsHeWpW0u3f36hn/JYKg4a5CINL30CJNDceAv7Eky8asN2Us dSlX8lm2Z0jabjTTbkIbzfjorynJLVM/zPdlYEYzmcZxsF+bGQ== X-Google-Smtp-Source: ABdhPJx/ncupXyfh+klLMSjl8x/Uq4mjstQoI7RqpY6Hdq5eg5yvVXJwKOCoo6tqhCE7aU8zFxbfz+yEi0P2c/X2ZZE= X-Received: by 2002:a2e:509:: with SMTP id 9mr5463172ljf.6.1624402947448; Tue, 22 Jun 2021 16:02:27 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Tue, 22 Jun 2021 18:02:16 -0500 Message-ID: Subject: [PATCH][CIFS] Fix uninitialized pointer access to dacl_ptr in build_sec_desc To: CIFS Cc: Shyam Prasad N Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org smb3: fix possible access to uninitialized pointer to DACL dacl_ptr can be null so we must check for it (ie if dacloffset is set) everywhere dacl_ptr is used in build_sec_desc - and we were missing one check Addresses-Coverity: 1475598 ("Explicit null dereference") From ec06cb04376e5abc927a9b85dd768ce8728965bb Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 22 Jun 2021 17:54:50 -0500 Subject: [PATCH] smb3: fix possible access to uninitialized pointer to DACL dacl_ptr can be null so we must check for it everywhere it is used in build_sec_desc. Addresses-Coverity: 1475598 ("Explicit null dereference") Signed-off-by: Steve French --- fs/cifs/cifsacl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 784407f9280f..25a8139336fa 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -1308,7 +1308,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, ndacl_ptr = (struct cifs_acl *)((char *)pnntsd + ndacloffset); ndacl_ptr->revision = dacloffset ? dacl_ptr->revision : cpu_to_le16(ACL_REVISION); - ndacl_ptr->num_aces = dacl_ptr->num_aces; + ndacl_ptr->num_aces = dacloffset ? dacl_ptr->num_aces : 0; if (uid_valid(uid)) { /* chown */ uid_t id; -- 2.30.2