* [PATCH v2] pps: generators: tio: fix platform_set_drvdata()
@ 2025-03-17 15:54 Raag Jadav
2025-03-17 16:47 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Raag Jadav @ 2025-03-17 15:54 UTC (permalink / raw)
To: giometti, gregkh, andriy.shevchenko; +Cc: linux-kernel, Raag Jadav
Currently driver_data user is expecting a pointer to pps_tio while
platform_set_drvdata() is setting a double pointer to it. Make them
consistent and fix illegal memory access in driver ->remove() path.
[ 156.254066] BUG: unable to handle page fault for address: ffffc9000117b738
[ 156.254099] #PF: supervisor read access in kernel mode
[ 156.254111] #PF: error_code(0x0000) - not-present page
[ 156.254197] RIP: 0010:hrtimer_active+0x2b/0x60
[ 156.254367] Call Trace:
[ 156.254375] <TASK>
[ 156.254382] ? show_regs+0x6d/0x80
[ 156.254393] ? __die+0x29/0x70
[ 156.254402] ? page_fault_oops+0x15f/0x4e0
[ 156.254415] ? hrtimer_active+0x2b/0x60
[ 156.254425] ? search_exception_tables+0x65/0x70
[ 156.254437] ? kernelmode_fixup_or_oops.constprop.0+0x61/0x80
[ 156.254451] ? __bad_area_nosemaphore+0x195/0x2c0
[ 156.254462] ? __lock_acquire+0xaaf/0x2840
[ 156.254475] ? bad_area_nosemaphore+0x16/0x20
[ 156.254486] ? do_kern_addr_fault.part.0+0x64/0x80
[ 156.254498] ? exc_page_fault+0x190/0x2c0
[ 156.254511] ? asm_exc_page_fault+0x2b/0x30
[ 156.254527] ? __pfx_pps_gen_tio_remove+0x10/0x10 [pps_gen_tio]
[ 156.254541] ? hrtimer_active+0x2b/0x60
[ 156.254551] hrtimer_cancel+0x19/0x50
[ 156.254561] pps_gen_tio_remove+0x1e/0x80 [pps_gen_tio]
Fixes: c89755d1111f ("pps: generators: Add PPS Generator TIO Driver")
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
---
v2: Update commit message (Greg, Andy)
drivers/pps/generators/pps_gen_tio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pps/generators/pps_gen_tio.c b/drivers/pps/generators/pps_gen_tio.c
index 6c46b46c66cd..6e4a383957d9 100644
--- a/drivers/pps/generators/pps_gen_tio.c
+++ b/drivers/pps/generators/pps_gen_tio.c
@@ -230,7 +230,7 @@ static int pps_gen_tio_probe(struct platform_device *pdev)
hrtimer_init(&tio->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
tio->timer.function = hrtimer_callback;
spin_lock_init(&tio->lock);
- platform_set_drvdata(pdev, &tio);
+ platform_set_drvdata(pdev, tio);
return 0;
}
base-commit: 6f119e3da79ce5e586340059403ab77201c1bb45
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] pps: generators: tio: fix platform_set_drvdata()
2025-03-17 15:54 [PATCH v2] pps: generators: tio: fix platform_set_drvdata() Raag Jadav
@ 2025-03-17 16:47 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-03-17 16:47 UTC (permalink / raw)
To: Raag Jadav; +Cc: giometti, gregkh, linux-kernel
On Mon, Mar 17, 2025 at 09:24:52PM +0530, Raag Jadav wrote:
> Currently driver_data user is expecting a pointer to pps_tio while
struct pps_tio
> platform_set_drvdata() is setting a double pointer to it.
"...which will point to the local stack of the probe function."
> Make them
> consistent and fix illegal memory access in driver ->remove() path.
>
> [ 156.254066] BUG: unable to handle page fault for address: ffffc9000117b738
> [ 156.254099] #PF: supervisor read access in kernel mode
> [ 156.254111] #PF: error_code(0x0000) - not-present page
These lines are not needed...
> [ 156.254197] RIP: 0010:hrtimer_active+0x2b/0x60
> [ 156.254367] Call Trace:
> [ 156.254375] <TASK>
> [ 156.254382] ? show_regs+0x6d/0x80
> [ 156.254393] ? __die+0x29/0x70
> [ 156.254402] ? page_fault_oops+0x15f/0x4e0
> [ 156.254415] ? hrtimer_active+0x2b/0x60
> [ 156.254425] ? search_exception_tables+0x65/0x70
> [ 156.254437] ? kernelmode_fixup_or_oops.constprop.0+0x61/0x80
> [ 156.254451] ? __bad_area_nosemaphore+0x195/0x2c0
> [ 156.254462] ? __lock_acquire+0xaaf/0x2840
> [ 156.254475] ? bad_area_nosemaphore+0x16/0x20
> [ 156.254486] ? do_kern_addr_fault.part.0+0x64/0x80
> [ 156.254498] ? exc_page_fault+0x190/0x2c0
> [ 156.254511] ? asm_exc_page_fault+0x2b/0x30
> [ 156.254527] ? __pfx_pps_gen_tio_remove+0x10/0x10 [pps_gen_tio]
...neither these.
> [ 156.254541] ? hrtimer_active+0x2b/0x60
> [ 156.254551] hrtimer_cancel+0x19/0x50
> [ 156.254561] pps_gen_tio_remove+0x1e/0x80 [pps_gen_tio]
As I said, ~3-5, okay maybe 7 lines is enough.
> Fixes: c89755d1111f ("pps: generators: Add PPS Generator TIO Driver")
> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> Acked-by: Rodolfo Giometti <giometti@enneenne.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-17 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-17 15:54 [PATCH v2] pps: generators: tio: fix platform_set_drvdata() Raag Jadav
2025-03-17 16:47 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®