Patch "ptp: Properly handle compat ioctls" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ptp: Properly handle compat ioctls

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ptp-properly-handle-compat-ioctls.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7d612e2d279e7223b19b6a2d11d480396dcb37e9
Author: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Date:   Sat Jan 25 10:28:38 2025 +0100

    ptp: Properly handle compat ioctls
    
    [ Upstream commit 19ae40f572a9ce1ade9954990af709a03fd37010 ]
    
    Pointer arguments passed to ioctls need to pass through compat_ptr() to
    work correctly on s390; as explained in Documentation/driver-api/ioctl.rst.
    Detect compat mode at runtime and call compat_ptr() for those commands
    which do take pointer arguments.
    
    Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
    Link: https://lore.kernel.org/lkml/1ba5d3a4-7931-455b-a3ce-85a968a7cb10@xxxxxxxxxxxxxxxx/
    Fixes: d94ba80ebbea ("ptp: Added a brand new class driver for ptp clocks.")
    Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
    Reviewed-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
    Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>
    Acked-by: Richard Cochran <richardcochran@xxxxxxxxx>
    Link: https://patch.msgid.link/20250125-posix-clock-compat_ioctl-v2-1-11c865c500eb@xxxxxxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index c48b9379ca094..8912e3efa00e2 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -4,6 +4,7 @@
  *
  * Copyright (C) 2010 OMICRON electronics GmbH
  */
+#include <linux/compat.h>
 #include <linux/module.h>
 #include <linux/posix-clock.h>
 #include <linux/poll.h>
@@ -159,6 +160,9 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
 	struct timespec64 ts;
 	int enable, err = 0;
 
+	if (in_compat_syscall() && cmd != PTP_ENABLE_PPS && cmd != PTP_ENABLE_PPS2)
+		arg = (unsigned long)compat_ptr(arg);
+
 	tsevq = pccontext->private_clkdata;
 
 	switch (cmd) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux