Re: [PATCH] PCI and I2C fixes for 2.6.8

From: Greg KH
Date: Mon Aug 23 2004 - 21:01:17 EST


ChangeSet 1.1807.56.25, 2004/08/06 15:26:03-07:00, johnpol@xxxxxxxxxxx

[PATCH] w1: Added w1_check_family().

w1_check_family() checks new family before registering it.

Signed-off-by: Evgeniy Polyakov <johnpol@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/w1/w1_family.c | 11 +++++++++++
1 files changed, 11 insertions(+)


diff -Nru a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
--- a/drivers/w1/w1_family.c 2004-08-23 11:04:14 -07:00
+++ b/drivers/w1/w1_family.c 2004-08-23 11:04:14 -07:00
@@ -27,11 +27,22 @@
spinlock_t w1_flock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(w1_families);

+static int w1_check_family(struct w1_family *f)
+{
+ if (!f->fops->rname || !f->fops->rbin || !f->fops->rval || !f->fops->rvalname)
+ return -EINVAL;
+
+ return 0;
+}
+
int w1_register_family(struct w1_family *newf)
{
struct list_head *ent, *n;
struct w1_family *f;
int ret = 0;
+
+ if (w1_check_family(newf))
+ return -EINVAL;

spin_lock(&w1_flock);
list_for_each_safe(ent, n, &w1_families) {

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