[PATCH net-next v2 3/7] atm: convert to getsockopt_iter

Breno Leitao leitao at debian.org
Wed May 20 08:50:54 PDT 2026


Hello Paolo,

On Tue, May 19, 2026 at 04:04:12PM +0200, Paolo Abeni wrote:
> On 5/15/26 10:32 AM, Breno Leitao wrote:
> > @@ -797,13 +798,13 @@ int vcc_setsockopt(struct socket *sock, int level, int optname,
> >  }
> >  
> >  int vcc_getsockopt(struct socket *sock, int level, int optname,
> > -		   char __user *optval, int __user *optlen)
> > +		   sockopt_t *opt)
> >  {
> >  	struct atm_vcc *vcc;
> > +	int val;
> 
> I *think* you should use 'unsigned long' here to avoid user-visible
> changes due to put_user() replacement.

I initially used 'unsigned long' in v1, but that proved incorrect and was
flagged by sashiko:

https://lore.kernel.org/all/agXhTGVurhrJmBNu@gmail.com/

The issue is that we need a 4-byte operation here since both __SO_SIZE
and SO_SETCLP are 4 bytes. Using an 8-byte type causes copy_to_iter() to
truncate the copy to 4 bytes while returning 4, which could result in
copying the upper portion of the 8-byte value (potentially all zeros,
depending on endianness).

Thanks for the review,
--breno



More information about the linux-afs mailing list