This is a note to let you know that I've just added the patch titled cifs: delete unnecessary NULL checks in cifs_chan_update_iface() to the 6.7-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: cifs-delete-unnecessary-null-checks-in-cifs_chan_upd.patch and it can be found in the queue-6.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 90efe2d68977e78baf039eb9bb8e0b06734613b0 Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Mon Jan 8 12:07:59 2024 +0300 cifs: delete unnecessary NULL checks in cifs_chan_update_iface() [ Upstream commit c3a11c0ec66c1e0652e3a2bb4f5cc74eea0ba486 ] We return early if "iface" is NULL so there is no need to check here. Delete those checks. Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Stable-dep-of: 16a57d768111 ("cifs: reduce warning log level for server not advertising interfaces") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index 94c5d50aa3474..0c2ac8d929a26 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -472,27 +472,23 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) kref_put(&old_iface->refcount, release_iface); } else if (!chan_index) { /* special case: update interface for primary channel */ - if (iface) { - cifs_dbg(FYI, "referencing primary channel iface: %pIS\n", - &iface->sockaddr); - iface->num_channels++; - iface->weight_fulfilled++; - } + cifs_dbg(FYI, "referencing primary channel iface: %pIS\n", + &iface->sockaddr); + iface->num_channels++; + iface->weight_fulfilled++; } spin_unlock(&ses->iface_lock); - if (iface) { - spin_lock(&ses->chan_lock); - chan_index = cifs_ses_get_chan_index(ses, server); - if (chan_index == CIFS_INVAL_CHAN_INDEX) { - spin_unlock(&ses->chan_lock); - return 0; - } - - ses->chans[chan_index].iface = iface; + spin_lock(&ses->chan_lock); + chan_index = cifs_ses_get_chan_index(ses, server); + if (chan_index == CIFS_INVAL_CHAN_INDEX) { spin_unlock(&ses->chan_lock); + return 0; } + ses->chans[chan_index].iface = iface; + spin_unlock(&ses->chan_lock); + return rc; }