linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] Serial: core: Add compat ioctl support
@ 2023-01-25 11:34 Viken Dadhaniya
  2023-01-25 12:24 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Viken Dadhaniya @ 2023-01-25 11:34 UTC (permalink / raw)
  To: gregkh, jirislaby, linux-serial, linux-kernel
  Cc: quic_msavaliy, quic_vnivarth, quic_vtanuku, quic_arandive,
	Viken Dadhaniya

Current serial core driver doesn't support compat_ioctl
due to which 32-bit application is not able to send
ioctls to driver on a 64-bit platform.

Added compat_ioctl support in serial core to handle
ioctls from 32-bit applications on a 64-bit platform.

Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
---
 drivers/tty/serial/serial_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index b9fbbee598b8..ad4c3a5a3d29 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1601,6 +1601,12 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
 	return ret;
 }
 
+static long
+uart_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
+{
+	return (long)uart_ioctl(tty, cmd, arg);
+};
+
 static void uart_set_ldisc(struct tty_struct *tty)
 {
 	struct uart_state *state = tty->driver_data;
@@ -2670,6 +2676,7 @@ static const struct tty_operations uart_ops = {
 	.chars_in_buffer= uart_chars_in_buffer,
 	.flush_buffer	= uart_flush_buffer,
 	.ioctl		= uart_ioctl,
+	.compat_ioctl   = uart_compat_ioctl,
 	.throttle	= uart_throttle,
 	.unthrottle	= uart_unthrottle,
 	.send_xchar	= uart_send_xchar,
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] Serial: core: Add compat ioctl support
  2023-01-25 11:34 [PATCH V2] Serial: core: Add compat ioctl support Viken Dadhaniya
@ 2023-01-25 12:24 ` Greg KH
  2023-02-02 10:14   ` Viken Dadhaniya
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2023-01-25 12:24 UTC (permalink / raw)
  To: Viken Dadhaniya
  Cc: jirislaby, linux-serial, linux-kernel, quic_msavaliy,
	quic_vnivarth, quic_vtanuku, quic_arandive

On Wed, Jan 25, 2023 at 05:04:18PM +0530, Viken Dadhaniya wrote:
> Current serial core driver doesn't support compat_ioctl
> due to which 32-bit application is not able to send
> ioctls to driver on a 64-bit platform.
> 
> Added compat_ioctl support in serial core to handle
> ioctls from 32-bit applications on a 64-bit platform.
> 
> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
> ---
>  drivers/tty/serial/serial_core.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index b9fbbee598b8..ad4c3a5a3d29 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1601,6 +1601,12 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
>  	return ret;
>  }
>  
> +static long
> +uart_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
> +{
> +	return (long)uart_ioctl(tty, cmd, arg);

How does this "fix" your out-of-tree driver at all?  What command is
being sent that has this incorrect that this simple "pass through" is
going to solve?

Can you point us at the out-of-tree code please?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] Serial: core: Add compat ioctl support
  2023-01-25 12:24 ` Greg KH
@ 2023-02-02 10:14   ` Viken Dadhaniya
  2023-02-02 10:32     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Viken Dadhaniya @ 2023-02-02 10:14 UTC (permalink / raw)
  To: Greg KH
  Cc: jirislaby, linux-serial, linux-kernel, quic_msavaliy,
	quic_vnivarth, quic_vtanuku, quic_arandive

Hi Greg,

"Can you point us at the out-of-tree code please?"

Please refer: 
https://git.codelinaro.org/clo/la/kernel/msm-5.10/-/blob/KERNEL.PLATFORM.1.0.r3-01300-kernel.0/drivers/tty/serial/msm_geni_serial.c#L750

Thanks

Viken Dadhaniya


On 1/25/2023 5:54 PM, Greg KH wrote:
> On Wed, Jan 25, 2023 at 05:04:18PM +0530, Viken Dadhaniya wrote:
>> Current serial core driver doesn't support compat_ioctl
>> due to which 32-bit application is not able to send
>> ioctls to driver on a 64-bit platform.
>>
>> Added compat_ioctl support in serial core to handle
>> ioctls from 32-bit applications on a 64-bit platform.
>>
>> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
>> ---
>>   drivers/tty/serial/serial_core.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
>> index b9fbbee598b8..ad4c3a5a3d29 100644
>> --- a/drivers/tty/serial/serial_core.c
>> +++ b/drivers/tty/serial/serial_core.c
>> @@ -1601,6 +1601,12 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
>>   	return ret;
>>   }
>>   
>> +static long
>> +uart_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
>> +{
>> +	return (long)uart_ioctl(tty, cmd, arg);
> How does this "fix" your out-of-tree driver at all?  What command is
> being sent that has this incorrect that this simple "pass through" is
> going to solve?
>
> Can you point us at the out-of-tree code please?
>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] Serial: core: Add compat ioctl support
  2023-02-02 10:14   ` Viken Dadhaniya
@ 2023-02-02 10:32     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2023-02-02 10:32 UTC (permalink / raw)
  To: Viken Dadhaniya
  Cc: jirislaby, linux-serial, linux-kernel, quic_msavaliy,
	quic_vnivarth, quic_vtanuku, quic_arandive

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Thu, Feb 02, 2023 at 03:44:45PM +0530, Viken Dadhaniya wrote:
> Hi Greg,
> 
> "Can you point us at the out-of-tree code please?"
> 
> Please refer: https://git.codelinaro.org/clo/la/kernel/msm-5.10/-/blob/KERNEL.PLATFORM.1.0.r3-01300-kernel.0/drivers/tty/serial/msm_geni_serial.c#L750

As this is a 5.10 link, are you sure this is the same codebase you are
using?

That ioctl handler does not touch the arg parameter at all, so what
would a compat_ioctl() handler be required for?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-02 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 11:34 [PATCH V2] Serial: core: Add compat ioctl support Viken Dadhaniya
2023-01-25 12:24 ` Greg KH
2023-02-02 10:14   ` Viken Dadhaniya
2023-02-02 10:32     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).