rtc subsystem, fix capability checks in kernel interface
PATCH 1/1 rtc subsystem, fix capability checks in kernel interface
Remove CAP_SYS_XXX checks from the in kernel interface. Those functions are meant to be used in-kernel only.
Signed-off-by Alessandro Zummo <[email protected]>
--- drivers/rtc/interface.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/rtc/interface.c +6 -16
@@ -229,6 +229,9 @@ int rtc_irq_set_state(struct class_devicunsigned long flags;struct rtc_device *rtc =to_rtc_device (class_dev); +if (rtc->ops->irq_set_state ==NULL ) +return -ENXIO ; +spin_lock_irqsave (&rtc->irq_task_lock, flags);if (rtc->irq_task != task) err = -ENXIO ;
@@ -243,25 +246,12 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);int rtc_irq_set_freq (struct class_device *class_dev,struct rtc_task *task,int freq) { -int err =0 , tmp =0 ; +int err =0 ;unsigned long flags;struct rtc_device *rtc =to_rtc_device (class_dev); -/* allowed range is 2-8192 */ -if (freq <2 || freq >8192 ) -return -EINVAL ; -/* -FIXME: this does not belong here, will move where appropriate -at a later stage. It cannot hurt right now, trust me :) -if ((freq > rtc_max_user_freq) && (!capable(CAP_SYS_RESOURCE))) -return -EACCES; -*/ -/* check if freq is a power of 2 */ -while (freq > (1 << tmp)) - tmp++; - -if (freq != (1 << tmp)) -return -EINVAL ; +if (rtc->ops->irq_set_freq ==NULL ) +return -ENXIO ;spin_lock_irqsave (&rtc->irq_task_lock, flags);if (rtc->irq_task != task)
Quoted 41 lines · Alessandro Zummo
Remove
CAP_SYS_XXXchecks from the in kernel interface. Those functions are meant to be used in-kernel only.Signed-off-by Alessandro Zummo <[email protected]>--- drivers/rtc/interface.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)drivers/rtc/interface.c +4
-11@@ -229,6 +229,9 @@ int rtc_irq_set_state(struct class_devicunsigned long flags;struct rtc_device *rtc =to_rtc_device (class_dev); +if (rtc->ops->irq_set_state ==NULL ) +return -ENXIO ; +spin_lock_irqsave (&rtc->irq_task_lock, flags);if (rtc->irq_task != task) err = -ENXIO ;@@ -243,25 +246,12 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);int rtc_irq_set_freq (struct class_device *class_dev,struct rtc_task *task,int freq) { -int err =0 , tmp =0 ; +int err =0 ;unsigned long flags;struct rtc_device *rtc =to_rtc_device (class_dev); -/* allowed range is 2-8192 */ -if (freq <2 || freq >8192 ) -return -EINVAL ; -/* -FIXME: this does not belong here, will move where appropriate -at a later stage. It cannot hurt right now, trust me :) -if ((freq > rtc_max_user_freq) && (!capable(CAP_SYS_RESOURCE))) -return -EACCES; -*/ -/* check if freq is a power of 2 */
drivers/rtc/interface.c EXPORT_SYMBOL_GPL(rtc_irq_set_state); · line 257
Quoted 10 lines
drivers/rtc/interface.c +2
-5-while (freq > (1 << tmp)) - tmp++; - -if (freq != (1 << tmp)) -return -EINVAL ; +if (rtc->ops->irq_set_freq ==NULL ) +return -ENXIO ;spin_lock_irqsave (&rtc->irq_task_lock, flags);if (rtc->irq_task != task)
The changelog and the patch don't have much correlation.
Are you sure this was the right patch?
Quoted 9 lines · On Wed, 17 May 2006 23:57:40 -0700 Andrew Morton <[email protected]> wrote:
Quoted 4 lines · Alessandro Zummo
Remove
CAP_SYS_XXXchecks from the in kernel interface. Those functions are meant to be used in-kernel only.The changelog and the patch don't have much correlation.
Are you sure this was the right patch?
I should have said "remove commented capability checks and add some others" :(
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Turin, Italy http://www.towertech.it