mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
Two timer subsystem fixes:
- Prevent a use after free in the new lockdep state tracking for hrtimers - Add missing parenthesis in the VF pit timer driver -----BEGIN PGP SIGNATURE----- iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAl6J2pgTHHRnbHhAbGlu dXRyb25peC5kZQAKCRCmGPVMDXSYoWM/D/4qlP3NvsRf/4dIqcmfOtaGmMC1yqug 4YbA6jQ2iecmgGprqN7JIKCHRgRyP2d72Ue6dmDKA8eOCcLmUsWy6dz5A+Ufi5wT S9S9dWctZSkmXSdEWkkBMHaefNFUNOTc16q4c4BFXomZzE4QZs+KjoVjJZBDtIqw A/9rmZKcBKxMpbuorE7zs6cRzsfvmiothXI+R78WMRbI+Yy3JAIuf3+uR1h7tXSi M8BNTTGn9U+Rnos/MFK5p136mwd5DHbCrX2G5KoYaox2CFGQ3+SvFGW9DWR38OTz IDP/RmH02s2AI0MNsQxrFFCQIpCentUEHWV5x5gjsw6DrHI23Xc98xbNdz3c9S+n WZMn63jvGr2XuH8XWb9tS72Zdp9VyKzubQ04xOEswvZg2KQuSntbUjq8RIEwSTMb xC82sJVXf20RX4iPsHcPKqPAWTgKRjNBuZbzxjRWjS/Ijtbdt8/GP/q9nZ3EKRvb 6k+bRWS6fbdRflhptCp9YmczE3/WX6SH02d0+m46x88SPzbxkg7sCMKjeJddiqXW XO2fRedYlbQXmGdUbvFrssRxLuGin4rYMAtZbO43t7uIf8KizPRE8EdUIaRpcYsS QftCReyHa1lu4+yCdknBIJ6eadzeeKaJed8FJLTp1KtPOQu68WryN1qG9Isa5o4R xcTq0+KI56XoKA== =y3EI -----END PGP SIGNATURE----- Merge tag 'timers-urgent-2020-04-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer fixes from Thomas Gleixner: "Two timer subsystem fixes: - Prevent a use after free in the new lockdep state tracking for hrtimers - Add missing parenthesis in the VF pit timer driver" * tag 'timers-urgent-2020-04-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/timer-vf-pit: Add missing parenthesis hrtimer: Don't dereference the hrtimer pointer after the callback
This commit is contained in:
commit
d5ca32738f
@ -129,7 +129,7 @@ static int __init pit_clockevent_init(unsigned long rate, int irq)
|
|||||||
__raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG);
|
__raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG);
|
||||||
|
|
||||||
BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL,
|
BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL,
|
||||||
"VF pit timer", &clockevent_pit);
|
"VF pit timer", &clockevent_pit));
|
||||||
|
|
||||||
clockevent_pit.cpumask = cpumask_of(0);
|
clockevent_pit.cpumask = cpumask_of(0);
|
||||||
clockevent_pit.irq = irq;
|
clockevent_pit.irq = irq;
|
||||||
|
@ -58,16 +58,21 @@ do { \
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define lockdep_hrtimer_enter(__hrtimer) \
|
# define lockdep_hrtimer_enter(__hrtimer) \
|
||||||
do { \
|
({ \
|
||||||
if (!__hrtimer->is_hard) \
|
bool __expires_hardirq = true; \
|
||||||
current->irq_config = 1; \
|
\
|
||||||
} while (0)
|
if (!__hrtimer->is_hard) { \
|
||||||
|
current->irq_config = 1; \
|
||||||
|
__expires_hardirq = false; \
|
||||||
|
} \
|
||||||
|
__expires_hardirq; \
|
||||||
|
})
|
||||||
|
|
||||||
# define lockdep_hrtimer_exit(__hrtimer) \
|
# define lockdep_hrtimer_exit(__expires_hardirq) \
|
||||||
do { \
|
do { \
|
||||||
if (!__hrtimer->is_hard) \
|
if (!__expires_hardirq) \
|
||||||
current->irq_config = 0; \
|
current->irq_config = 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define lockdep_posixtimer_enter() \
|
# define lockdep_posixtimer_enter() \
|
||||||
do { \
|
do { \
|
||||||
@ -102,8 +107,8 @@ do { \
|
|||||||
# define lockdep_hardirq_exit() do { } while (0)
|
# define lockdep_hardirq_exit() do { } while (0)
|
||||||
# define lockdep_softirq_enter() do { } while (0)
|
# define lockdep_softirq_enter() do { } while (0)
|
||||||
# define lockdep_softirq_exit() do { } while (0)
|
# define lockdep_softirq_exit() do { } while (0)
|
||||||
# define lockdep_hrtimer_enter(__hrtimer) do { } while (0)
|
# define lockdep_hrtimer_enter(__hrtimer) false
|
||||||
# define lockdep_hrtimer_exit(__hrtimer) do { } while (0)
|
# define lockdep_hrtimer_exit(__context) do { } while (0)
|
||||||
# define lockdep_posixtimer_enter() do { } while (0)
|
# define lockdep_posixtimer_enter() do { } while (0)
|
||||||
# define lockdep_posixtimer_exit() do { } while (0)
|
# define lockdep_posixtimer_exit() do { } while (0)
|
||||||
# define lockdep_irq_work_enter(__work) do { } while (0)
|
# define lockdep_irq_work_enter(__work) do { } while (0)
|
||||||
|
@ -1480,6 +1480,7 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
|
|||||||
unsigned long flags) __must_hold(&cpu_base->lock)
|
unsigned long flags) __must_hold(&cpu_base->lock)
|
||||||
{
|
{
|
||||||
enum hrtimer_restart (*fn)(struct hrtimer *);
|
enum hrtimer_restart (*fn)(struct hrtimer *);
|
||||||
|
bool expires_in_hardirq;
|
||||||
int restart;
|
int restart;
|
||||||
|
|
||||||
lockdep_assert_held(&cpu_base->lock);
|
lockdep_assert_held(&cpu_base->lock);
|
||||||
@ -1514,11 +1515,11 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
|
|||||||
*/
|
*/
|
||||||
raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
|
raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
|
||||||
trace_hrtimer_expire_entry(timer, now);
|
trace_hrtimer_expire_entry(timer, now);
|
||||||
lockdep_hrtimer_enter(timer);
|
expires_in_hardirq = lockdep_hrtimer_enter(timer);
|
||||||
|
|
||||||
restart = fn(timer);
|
restart = fn(timer);
|
||||||
|
|
||||||
lockdep_hrtimer_exit(timer);
|
lockdep_hrtimer_exit(expires_in_hardirq);
|
||||||
trace_hrtimer_expire_exit(timer);
|
trace_hrtimer_expire_exit(timer);
|
||||||
raw_spin_lock_irq(&cpu_base->lock);
|
raw_spin_lock_irq(&cpu_base->lock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user