[7/8] fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr()

Message ID a1170a72-0dc1-4092-bb22-7279dcdf3c0a@paragon-software.com
State New
Headers
Series fs/ntfs3: Bugfix and refactoring |

Commit Message

Konstantin Komarov Sept. 26, 2023, 9:57 a.m. UTC
  Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
  fs/ntfs3/frecord.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

          put_page(pg);
  

Patch

diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index d49fbb22bd5e..dad976a68985 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -2148,7 +2148,7 @@  int ni_readpage_cmpr(struct ntfs_inode *ni, struct 
page *page)

      for (i = 0; i < pages_per_frame; i++) {
          pg = pages[i];
-        if (i == idx)
+        if (i == idx || !pg)
              continue;
          unlock_page(pg);