lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080515164805.GA7162@il.ibm.com>
Date:	Thu, 15 May 2008 19:48:05 +0300
From:	Muli Ben-Yehuda <muli@...ibm.com>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	akpm@...l.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] OSS trident: switch from ->write_proc

On Thu, May 15, 2008 at 12:49:30AM +0400, Alexey Dobriyan wrote:

> Sorry, I just want to remove ->write_proc totally and auditing proc
> users are for later.

Ok, here's an updated patch to not leak the proc entry. Fix is
trivial, so I took the liberty of keeping your 'From' and
'Signed-off-by' lines. Andrew, please push to Linus.

Subject: [PATCH] OSS trident: switch from ->write_proc
From: Alexey Dobriyan <adobriyan@...il.com>

[muli: don't leak the proc entry]

Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
Signed-off-by: Muli Ben-Yehuda <muli@...ibm.com>
---
 sound/oss/trident.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index f43f91e..ff70a81 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -4028,10 +4028,10 @@ ali_free_other_states_resources(struct trident_state *state)
 
 static struct proc_dir_entry *res;
 
-static int
-ali_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data)
+static ssize_t
+ali_write_proc(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
-	struct trident_card *card = (struct trident_card *) data;
+	struct trident_card *card = PDE(file->f_path.dentry->d_inode)->data;
 	unsigned long flags;
 	char c;
 
@@ -4068,6 +4068,11 @@ ali_write_proc(struct file *file, const char __user *buffer, unsigned long count
 	return count;
 }
 
+static const struct file_operations ali_proc_fops = {
+	.owner	= THIS_MODULE,
+	.write	= ali_write_proc,
+};
+
 /* OSS /dev/mixer file operation methods */
 static int
 trident_open_mixdev(struct inode *inode, struct file *file)
@@ -4441,11 +4446,8 @@ trident_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
 		/* ALi SPDIF OUT function */
 		if (card->revision == ALI_5451_V02) {
 			ali_setup_spdif_out(card, ALI_PCM_TO_SPDIF_OUT);
-			res = create_proc_entry("ALi5451", 0, NULL);
-			if (res) {
-				res->write_proc = ali_write_proc;
-				res->data = card;
-			}
+			res = proc_create_data("ALi5451", 0, NULL,
+					       &ali_proc_fops, card);
 		}
 
 		/* Add H/W Volume Control By Matt Wu Jul. 06, 2001 */
-- 
1.5.2.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ