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]
Date:	Wed, 18 Mar 2015 18:18:53 +0300
From:	Evgeniy Polyakov <zbr@...emap.net>
To:	David Fries <david@...es.net>
Cc:	Thorsten Bschorr <thorsten@...horr.de>,
	Jonathan ALIBERT <jonathan.alibert@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Avoid null-pointer access in w1/slaves/w1_therm

Hi

18.03.2015, 07:20, "David Fries" <david@...es.net>:
>  static void w1_therm_remove_slave(struct w1_slave *sl)
>  {
> + int refcnt = atomic_sub_return(1, THERM_REFCNT(sl->family_data));
> + while(refcnt) {
> + msleep(1000);
> + refcnt = atomic_read(THERM_REFCNT(sl->family_data));
> + }
>          kfree(sl->family_data);
>          sl->family_data = NULL;
>  }

Can we replace this whole atomic manipulations with kref_t and free family data in the place
which actually drops reference counter to zero?

I.e. we return from remove_slave() function potentially leaving family data floating around, it will be freed
when the last user drops the reference. There is still a race between increasing reference when starting
reading and removing slave device, i.e. one starts reading, while attached slave device is being removed,
but that's a different problem.
--
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