fsntfs.c (fa3cacf544636b2dc48cfb2f277a2071f14d66a2) fsntfs.c (195c52bdd5d5ecfdabf5a7c6159efe299e534f84)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 *
4 * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
5 *
6 */
7
8#include <linux/blkdev.h>

--- 2021 unchanged lines hidden (view full) ---

2030 * looks like too big security. 0x10000 - is arbitrary big number
2031 */
2032 err = -EFBIG;
2033 goto out;
2034 }
2035
2036 *size = t32 - SIZEOF_SECURITY_HDR;
2037
1// SPDX-License-Identifier: GPL-2.0
2/*
3 *
4 * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
5 *
6 */
7
8#include <linux/blkdev.h>

--- 2021 unchanged lines hidden (view full) ---

2030 * looks like too big security. 0x10000 - is arbitrary big number
2031 */
2032 err = -EFBIG;
2033 goto out;
2034 }
2035
2036 *size = t32 - SIZEOF_SECURITY_HDR;
2037
2038 p = ntfs_malloc(*size);
2038 p = kmalloc(*size, GFP_NOFS);
2039 if (!p) {
2040 err = -ENOMEM;
2041 goto out;
2042 }
2043
2044 err = ntfs_read_run_nb(sbi, &ni->file.run,
2045 le64_to_cpu(sii_e->sec_hdr.off), &d_security,
2046 sizeof(d_security), NULL);

--- 11 unchanged lines hidden (view full) ---

2058 p, *size, NULL);
2059 if (err)
2060 goto out;
2061
2062 *sd = p;
2063 p = NULL;
2064
2065out:
2039 if (!p) {
2040 err = -ENOMEM;
2041 goto out;
2042 }
2043
2044 err = ntfs_read_run_nb(sbi, &ni->file.run,
2045 le64_to_cpu(sii_e->sec_hdr.off), &d_security,
2046 sizeof(d_security), NULL);

--- 11 unchanged lines hidden (view full) ---

2058 p, *size, NULL);
2059 if (err)
2060 goto out;
2061
2062 *sd = p;
2063 p = NULL;
2064
2065out:
2066 ntfs_free(p);
2066 kfree(p);
2067 fnd_put(fnd_sii);
2068 ni_unlock(ni);
2069
2070 return err;
2071}
2072
2073/*
2074 * ntfs_insert_security

--- 35 unchanged lines hidden (view full) ---

2110 hash_key.hash = security_hash(sd, size_sd);
2111 hash_key.sec_id = SECURITY_ID_INVALID;
2112
2113 if (inserted)
2114 *inserted = false;
2115 *security_id = SECURITY_ID_INVALID;
2116
2117 /* Allocate a temporal buffer*/
2067 fnd_put(fnd_sii);
2068 ni_unlock(ni);
2069
2070 return err;
2071}
2072
2073/*
2074 * ntfs_insert_security

--- 35 unchanged lines hidden (view full) ---

2110 hash_key.hash = security_hash(sd, size_sd);
2111 hash_key.sec_id = SECURITY_ID_INVALID;
2112
2113 if (inserted)
2114 *inserted = false;
2115 *security_id = SECURITY_ID_INVALID;
2116
2117 /* Allocate a temporal buffer*/
2118 d_security = ntfs_zalloc(aligned_sec_size);
2118 d_security = kzalloc(aligned_sec_size, GFP_NOFS);
2119 if (!d_security)
2120 return -ENOMEM;
2121
2122 mutex_lock_nested(&ni->ni_lock, NTFS_INODE_MUTEX_SECURITY);
2123
2124 fnd_sdh = fnd_get();
2125 if (!fnd_sdh) {
2126 err = -ENOMEM;

--- 147 unchanged lines hidden (view full) ---

2274 /* Update Id and offset for next descriptor */
2275 sbi->security.next_id += 1;
2276 sbi->security.next_off += aligned_sec_size;
2277
2278out:
2279 fnd_put(fnd_sdh);
2280 mark_inode_dirty(&ni->vfs_inode);
2281 ni_unlock(ni);
2119 if (!d_security)
2120 return -ENOMEM;
2121
2122 mutex_lock_nested(&ni->ni_lock, NTFS_INODE_MUTEX_SECURITY);
2123
2124 fnd_sdh = fnd_get();
2125 if (!fnd_sdh) {
2126 err = -ENOMEM;

--- 147 unchanged lines hidden (view full) ---

2274 /* Update Id and offset for next descriptor */
2275 sbi->security.next_id += 1;
2276 sbi->security.next_off += aligned_sec_size;
2277
2278out:
2279 fnd_put(fnd_sdh);
2280 mark_inode_dirty(&ni->vfs_inode);
2281 ni_unlock(ni);
2282 ntfs_free(d_security);
2282 kfree(d_security);
2283
2284 return err;
2285}
2286
2287/*
2288 * ntfs_reparse_init
2289 *
2290 * loads and parse $Extend/$Reparse

--- 258 unchanged lines hidden ---
2283
2284 return err;
2285}
2286
2287/*
2288 * ntfs_reparse_init
2289 *
2290 * loads and parse $Extend/$Reparse

--- 258 unchanged lines hidden ---