NetBSD Problem Report #58018

From www@netbsd.org  Sat Mar  9 19:02:12 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B6A2E1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  9 Mar 2024 19:02:12 +0000 (UTC)
Message-Id: <20240309190211.7E2721A923F@mollari.NetBSD.org>
Date: Sat,  9 Mar 2024 19:02:11 +0000 (UTC)
From: holovati@gmail.com
Reply-To: holovati@gmail.com
To: gnats-bugs@NetBSD.org
Subject: ext2fs readdir (d_type conversion error)
X-Send-Pr-Version: www-1.0

>Number:         58018
>Category:       kern
>Synopsis:       ext2fs readdir (d_type conversion error)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 09 19:05:00 +0000 2024
>Last-Modified:  Sun Mar 10 17:40:02 +0000 2024
>Originator:     Damir Holovati
>Release:        trunk
>Organization:
n/a
>Environment:
>Description:
sys/ufs/ext2fs/ext2fs_dir.h:173

static __inline uint8_t
ext2dt2dt(uint8_t type)
{
	switch (type) {
	case EXT2_FT_REG_FILE:
		return DT_FIFO; <---------------- THIS IS NOT CORRECT
	case EXT2_FT_DIR:
		return DT_DIR;
	case EXT2_FT_CHRDEV:
		return DT_CHR;
	case EXT2_FT_BLKDEV:
		return DT_BLK;
	case EXT2_FT_FIFO:
		return DT_FIFO;
	case EXT2_FT_SOCK:
		return DT_SOCK;
	case EXT2_FT_SYMLINK:
		return DT_LNK;
	default:
		return DT_UNKNOWN;
	}
}

>How-To-Repeat:
Mount a ext2 volume and invoke ls.
>Fix:
static __inline uint8_t
ext2dt2dt(uint8_t type)
{
	switch (type) {
	case EXT2_FT_REG_FILE:
		return DT_REG;
	case EXT2_FT_DIR:
		return DT_DIR;
	case EXT2_FT_CHRDEV:
		return DT_CHR;
	case EXT2_FT_BLKDEV:
		return DT_BLK;
	case EXT2_FT_FIFO:
		return DT_FIFO;
	case EXT2_FT_SOCK:
		return DT_SOCK;
	case EXT2_FT_SYMLINK:
		return DT_LNK;
	default:
		return DT_UNKNOWN;
	}
}

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58018 CVS commit: src/sys/ufs/ext2fs
Date: Sun, 10 Mar 2024 13:36:33 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sun Mar 10 17:36:33 UTC 2024

 Modified Files:
 	src/sys/ufs/ext2fs: ext2fs_dir.h

 Log Message:
 PR/58018: Damir Holovati: ext2fs readdir (d_type conversion error)


 To generate a diff of this commit:
 cvs rdiff -u -r1.22 -r1.23 src/sys/ufs/ext2fs/ext2fs_dir.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.