Skip to contentSkip to conversation

vfs: delete fasync_struct.magic

PATCH New Alexey Dobriyan 1 participant 1 message Nov 27

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfs: delete fasync_struct.magic

Memory corruptions are supposed to be found by KASAN these days.

---
 Documentation/staging/magic-number.rst                    | 1 -
 Documentation/translations/it_IT/staging/magic-number.rst | 1 -
 Documentation/translations/sp_SP/process/magic-number.rst | 1 -
 Documentation/translations/zh_CN/process/magic-number.rst | 1 -
 Documentation/translations/zh_TW/process/magic-number.rst | 1 -
 fs/fcntl.c                                                | 6 ------
 include/linux/fs.h                                        | 3 ---
 7 files changed, 14 deletions(-)
Documentation/staging/magic-number.rst +0 -1
index 670d3189a976..6cc11ee25f53 100644
@@ -70,7 +70,6 @@ Magic Name            Number           Structure                File
 ===================== ================ ======================== ==========================================
 PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/uapi/linux/pg.h``
 APM_BIOS_MAGIC        0x4101           apm_user                 ``arch/x86/kernel/apm_32.c``
-FASYNC_MAGIC          0x4601           fasync_struct            ``include/linux/fs.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip/slip.h``
 KV_MAGIC              0x5f4b565f       kernel_vars_s            ``arch/mips/include/asm/sn/klkernvars.h``
 CODA_MAGIC            0xC0DAC0DA       coda_file_info           ``fs/coda/coda_fs_i.h``
Documentation/translations/it_IT/staging/magic-number.rst +0 -1
index 43dd6398300b..f1d61e5525d1 100644
@@ -76,7 +76,6 @@ Nome magico           Numero           Struttura                File
 ===================== ================ ======================== ==========================================
 PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/pg.h``
 APM_BIOS_MAGIC        0x4101           apm_user                 ``arch/x86/kernel/apm_32.c``
-FASYNC_MAGIC          0x4601           fasync_struct            ``include/linux/fs.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 KV_MAGIC              0x5f4b565f       kernel_vars_s            ``arch/mips/include/asm/sn/klkernvars.h``
 CODA_MAGIC            0xC0DAC0DA       coda_file_info           ``fs/coda/coda_fs_i.h``
Documentation/translations/sp_SP/process/magic-number.rst +0 -1
index f5b4c3f2849f..58834098ac27 100644
@@ -75,7 +75,6 @@ Magic Name            Number           Structure                File
 ===================== ================ ======================== ==========================================
 PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/pg.h``
 APM_BIOS_MAGIC        0x4101           apm_user                 ``arch/x86/kernel/apm_32.c``
-FASYNC_MAGIC          0x4601           fasync_struct            ``include/linux/fs.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 KV_MAGIC              0x5f4b565f       kernel_vars_s            ``arch/mips/include/asm/sn/klkernvars.h``
 CODA_MAGIC            0xC0DAC0DA       coda_file_info           ``fs/coda/coda_fs_i.h``
Documentation/translations/zh_CN/process/magic-number.rst +0 -1
index 05ee75cf4346..7d825a37ebef 100644
@@ -68,7 +68,6 @@ tty源码经常通过特定驱动使用这种方法用来反复地排列特定
 ===================== ================ ======================== ==========================================
 PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/pg.h``
 APM_BIOS_MAGIC        0x4101           apm_user                 ``arch/x86/kernel/apm_32.c``
-FASYNC_MAGIC          0x4601           fasync_struct            ``include/linux/fs.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 KV_MAGIC              0x5f4b565f       kernel_vars_s            ``arch/mips/include/asm/sn/klkernvars.h``
 CODA_MAGIC            0xC0DAC0DA       coda_file_info           ``fs/coda/coda_fs_i.h``
Documentation/translations/zh_TW/process/magic-number.rst +0 -1
index bc7eb025dd1e..384149cad76a 100644
@@ -62,7 +62,6 @@ Linux 魔術數
 ===================== ================ ======================== ==========================================
 PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/pg.h``
 APM_BIOS_MAGIC        0x4101           apm_user                 ``arch/x86/kernel/apm_32.c``
-FASYNC_MAGIC          0x4601           fasync_struct            ``include/linux/fs.h``
 SLIP_MAGIC            0x5302           slip                     ``drivers/net/slip.h``
 KV_MAGIC              0x5f4b565f       kernel_vars_s            ``arch/mips/include/asm/sn/klkernvars.h``
 CODA_MAGIC            0xC0DAC0DA       coda_file_info           ``fs/coda/coda_fs_i.h``
fs/fcntl.c +0 -6
index 9b71bc9d71d1..5e49ec102baa 100644
@@ -1066,7 +1066,6 @@ struct fasync_struct *fasync_insert_entry(int fd, struct file *filp, struct fasy
 	}
 
 	rwlock_init(&new->fa_lock);
-	new->magic = FASYNC_MAGIC;
 	new->fa_file = filp;
 	new->fa_fd = fd;
 	new->fa_next = *fapp;
@@ -1130,11 +1129,6 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
 		struct fown_struct *fown;
 		unsigned long flags;
 
-		if (fa->magic != FASYNC_MAGIC) {
-			printk(KERN_ERR "kill_fasync: bad magic number in "
-			       "fasync_struct!\n");
-			return;
-		}
 		read_lock_irqsave(&fa->fa_lock, flags);
 		if (fa->fa_file) {
 			fown = file_f_owner(fa->fa_file);
include/linux/fs.h +0 -3
index 5b3a100aba77..053a6e04cd91 100644
@@ -1369,15 +1369,12 @@ static inline struct dentry *file_dentry(const struct file *file)
 
 struct fasync_struct {
 	rwlock_t		fa_lock;
-	int			magic;
 	int			fa_fd;
 	struct fasync_struct	*fa_next; /* singly linked list */
 	struct file		*fa_file;
 	struct rcu_head		fa_rcu;
 };
 
-#define FASYNC_MAGIC 0x4601
-
 /* SMP safe fasync helpers: */
 extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
 extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *);
Signature · 1 line
2.56.1