Message ID | 20200610172213.GA90634@mwanda (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] exfat: add missing brelse() calls on error paths | expand |
> If the second exfat_get_dentry() call fails then we need to release > "old_bh" before returning. There is a similar bug in exfat_move_file(). Would you like to convert any information from this change description into an imperative wording? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=5b14671be58d0084e7e2d1cc9c2c36a94467f6e0#n151 Regards, Markus
On Wed, Jun 10, 2020 at 08:12:46PM +0200, Markus Elfring wrote: > > If the second exfat_get_dentry() call fails then we need to release > > "old_bh" before returning. There is a similar bug in exfat_move_file(). > > Would you like to convert any information from this change description > into an imperative wording? > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=5b14671be58d0084e7e2d1cc9c2c36a94467f6e0#n151 I really feel like imperative doesn't add anything. I understand that some people feel really strongly about it, but I don't know why. It doesn't make commit messages more understandable. The important thing is that the problem is clear, the fix is clear and the runtime impact is clear. regards, dan carpenter
>>> If the second exfat_get_dentry() call fails then we need to release >>> "old_bh" before returning. There is a similar bug in exfat_move_file(). >> >> Would you like to convert any information from this change description >> into an imperative wording? >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=5b14671be58d0084e7e2d1cc9c2c36a94467f6e0#n151 > > I really feel like imperative doesn't add anything. I understand that > some people feel really strongly about it, but I don't know why. It > doesn't make commit messages more understandable. Do you insist to deviate from the given guideline? > The important thing is that the problem is clear, the fix is clear and > the runtime impact is clear. I have got further ideas to improve also this commit message. I am curious if other contributors would like to add another bit of patch review. Regards, Markus
On Wed, Jun 10, 2020 at 08:56:26PM +0200, Markus Elfring wrote: > >>> If the second exfat_get_dentry() call fails then we need to release > >>> "old_bh" before returning. There is a similar bug in exfat_move_file(). > >> > >> Would you like to convert any information from this change description > >> into an imperative wording? > >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=5b14671be58d0084e7e2d1cc9c2c36a94467f6e0#n151 > > > > I really feel like imperative doesn't add anything. I understand that > > some people feel really strongly about it, but I don't know why. It > > doesn't make commit messages more understandable. > > Do you insist to deviate from the given guideline? > > > > The important thing is that the problem is clear, the fix is clear and > > the runtime impact is clear. > > I have got further ideas to improve also this commit message. > I am curious if other contributors would like to add another bit of > patch review. You're nitpicking commit messages. This is exactly the kind of thing which drives people away. Dan's commit message is fine. It's actually hilarious because your emails are so unclear that I can't understand them. I have no idea what "collateral evolution" means and yet you use it in almost every email. Why can't you use the same terminology the rest of us use?
> You're nitpicking commit messages. I am occasionally trying to achieve corresponding improvements. > This is exactly the kind of thing which drives people away. Would you like to follow official patch process documentation? > Dan's commit message is fine. I have got the impression that he indicates another deviation from a well-known requirement. I am curious under which circumstances such a patch review concern will be taken into account finally. > It's actually hilarious because your emails are so unclear that I > can't understand them. I find such feedback surprising and interesting. I hope that we can reduce understanding difficulties together. > I have no idea what "collateral evolution" means This term expresses the situation that a single change can trigger further changes. Examples for programmers: A) * You add an argument to an used function. * How many function calls will need related adjustments? B) * Some function calls can fail. * How do you think about to complete error detection and the corresponding exception handling? > and yet you use it in almost every email. You exaggerate here. > Why can't you use the same terminology the rest of us use? I got also used to some wording approaches. Which terminology variation do you prefer? Regards, Markus
> If the second exfat_get_dentry() call fails then we need to release "old_bh" before returning. There > is a similar bug in exfat_move_file(). > > Fixes: 5f2aa075070c ("exfat: add inode operations") > Reported-by: Markus Elfring <Markus.Elfring@web.de> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Applied. Thanks!
… > +++ b/fs/exfat/namei.c > @@ -1077,10 +1077,14 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, > > epold = exfat_get_dentry(sb, p_dir, oldentry + 1, &old_bh, > §or_old); > + if (!epold) > + return -EIO; … Can it become helpful to annotate such null pointer checks for branch prediction? Would you like to indicate a likelihood in any way? Regards, Markus
… > +++ b/fs/exfat/namei.c > @@ -1077,10 +1077,14 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, > > epold = exfat_get_dentry(sb, p_dir, oldentry + 1, &old_bh, > §or_old); > + if (!epold) > + return -EIO; … Will there be a need to reconsider the indentation for function call parameters in such source files? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=b29482fde649c72441d5478a4ea2c52c56d97a5e#n93 Regards, Markus
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 5b0f35329d63e..edd8023865a0e 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -1077,10 +1077,14 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir, epold = exfat_get_dentry(sb, p_dir, oldentry + 1, &old_bh, §or_old); + if (!epold) + return -EIO; epnew = exfat_get_dentry(sb, p_dir, newentry + 1, &new_bh, §or_new); - if (!epold || !epnew) + if (!epnew) { + brelse(old_bh); return -EIO; + } memcpy(epnew, epold, DENTRY_SIZE); exfat_update_bh(sb, new_bh, sync); @@ -1161,10 +1165,14 @@ static int exfat_move_file(struct inode *inode, struct exfat_chain *p_olddir, epmov = exfat_get_dentry(sb, p_olddir, oldentry + 1, &mov_bh, §or_mov); + if (!epmov) + return -EIO; epnew = exfat_get_dentry(sb, p_newdir, newentry + 1, &new_bh, §or_new); - if (!epmov || !epnew) + if (!epnew) { + brelse(mov_bh); return -EIO; + } memcpy(epnew, epmov, DENTRY_SIZE); exfat_update_bh(sb, new_bh, IS_DIRSYNC(inode));
If the second exfat_get_dentry() call fails then we need to release "old_bh" before returning. There is a similar bug in exfat_move_file(). Fixes: 5f2aa075070c ("exfat: add inode operations") Reported-by: Markus Elfring <Markus.Elfring@web.de> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- v2: fix exfat_move_file() as well. Also add a Fixes tag. fs/exfat/namei.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)