[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZK3AZzm0BCglXXKN@duo.ucw.cz>
Date: Tue, 11 Jul 2023 22:49:43 +0200
From: Pavel Machek <pavel@....cz>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Shyam Prasad N <sprasad@...rosoft.com>,
kernel test robot <lkp@...el.com>,
Dan Carpenter <error27@...il.com>,
Steve French <stfrench@...rosoft.com>, pc@....nz,
lsahlber@...hat.com, pc@...guebit.com, ematsumiya@...e.de,
zhangxiaoxu5@...wei.com, dhowells@...hat.com, brauner@...nel.org,
vl@...ba.org
Subject: Re: [PATCH AUTOSEL 6.1 06/15] cifs: fix sockaddr comparison in
iface_cmp
Hi!
> +++ b/fs/cifs/connect.c
> @@ -1332,6 +1332,56 @@ cifs_demultiplex_thread(void *p)
> module_put_and_kthread_exit(0);
> }
>
> +++ b/fs/cifs/smb2ops.c
> @@ -510,6 +510,43 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
> return rsize;
> }
>
> +/*
> + * compare two interfaces a and b
> + * return 0 if everything matches.
> + * return 1 if a is rdma capable, or rss capable, or has higher link speed
> + * return -1 otherwise.
> + */
> +static int
> +iface_cmp(struct cifs_server_iface *a, struct cifs_server_iface *b)
> +{
> + int cmp_ret = 0;
> +
> + WARN_ON(!a || !b);
> + if (a->rdma_capable == b->rdma_capable) {
> + if (a->rss_capable == b->rss_capable) {
> + if (a->speed == b->speed) {
> + cmp_ret = cifs_ipaddr_cmp((struct sockaddr *) &a->sockaddr,
> + (struct sockaddr *) &b->sockaddr);
> + if (!cmp_ret)
> + return 0;
> + else if (cmp_ret > 0)
> + return 1;
> + else
> + return -1;
cifs_ipaddr_cmp already returns 0/1/-1, so this can really be "return cmp_ret".
Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists