From: Dan Carpenter <dan.carpenter@oracle.com>
To: scabrero@suse.de
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifs: Simplify reconnect code when dfs upcall is enabled
Date: Thu, 17 Dec 2020 15:21:48 +0300 [thread overview]
Message-ID: <X9tNXBJunTCYCoSw@mwanda> (raw)
Hello Samuel Cabrero,
The patch 7d6535b72042: "cifs: Simplify reconnect code when dfs
upcall is enabled" from Nov 30, 2020, leads to the following static
checker warning:
fs/cifs/connect.c:160 reconn_set_next_dfs_target()
error: 'server->hostname' dereferencing possible ERR_PTR()
fs/cifs/connect.c
128 static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
129 struct cifs_sb_info *cifs_sb,
130 struct dfs_cache_tgt_list *tgt_list,
131 struct dfs_cache_tgt_iterator **tgt_it)
132 {
133 const char *name;
134 int rc;
135
136 if (!cifs_sb || !cifs_sb->origin_fullpath)
137 return;
138
139 if (!*tgt_it) {
140 *tgt_it = dfs_cache_get_tgt_iterator(tgt_list);
141 } else {
142 *tgt_it = dfs_cache_get_next_tgt(tgt_list, *tgt_it);
143 if (!*tgt_it)
144 *tgt_it = dfs_cache_get_tgt_iterator(tgt_list);
145 }
146
147 cifs_dbg(FYI, "%s: UNC: %s\n", __func__, cifs_sb->origin_fullpath);
148
149 name = dfs_cache_get_tgt_name(*tgt_it);
150
151 kfree(server->hostname);
152
153 server->hostname = extract_hostname(name);
154 if (IS_ERR(server->hostname)) {
^^^^^^^^^^^^^^^^
155 cifs_dbg(FYI,
156 "%s: failed to extract hostname from target: %ld\n",
157 __func__, PTR_ERR(server->hostname));
This should probably just return here. I don't totally understand why
this is a void function...
158 }
159
160 rc = reconn_set_ipaddr_from_hostname(server);
^^^^^^
"server->hostname" is dereferenced inside the function.
161 if (rc) {
162 cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
163 __func__, rc);
164 }
165 }
regards,
dan carpenter
next reply other threads:[~2020-12-17 12:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 12:21 Dan Carpenter [this message]
2020-12-18 9:29 ` [PATCH] cifs: Avoid error pointer dereference Samuel Cabrero
2020-12-18 13:45 ` Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X9tNXBJunTCYCoSw@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-cifs@vger.kernel.org \
--cc=scabrero@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.