[LU-525] llapi_file_get_stripe() fails with ENAMETOOLONG Created: 21/Jul/11 Updated: 14/Jul/14 Resolved: 11/Oct/11 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 1.8.6 |
| Fix Version/s: | Lustre 1.8.7 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Johann Lombardi (Inactive) | Assignee: | Johann Lombardi (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Severity: | 3 |
| Bugzilla ID: | 22,766 |
| Rank (Obsolete): | 6578 |
| Description |
|
The patch from bugzilla ticket 22766 added the following code: diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 1e88a51..72818c8 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1566,6 +1566,8 @@ int llapi_file_get_stripe(const char *path, struct lov_user_md *lum) int fd, rc = 0; fname = strrchr(path, '/'); + if (strlen(fname) + 1 < sizeof(struct lov_user_md)) + return ENAMETOOLONG; This check does not make any sense and causes llapi_file_get_stripe() to fail with ENAMETOOLONG without any obvious reasons. |
| Comments |
| Comment by Johann Lombardi (Inactive) [ 21/Jul/11 ] |
| Comment by Andreas Dilger [ 21/Jul/11 ] |
|
Seems that I pointed this out during inspection, but it was landed anyway: https://bugzilla.lustre.org/show_bug.cgi?id=22766#c39 I agree that check makes no sense and should be removed. Strange that it wasn't reported before. |
| Comment by Johann Lombardi (Inactive) [ 21/Jul/11 ] |
|
Patch landed. |
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Build Master (Inactive) [ 21/Jul/11 ] |
|
Integrated in Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
|
| Comment by Ryan Haasken [ 14/Jul/14 ] |
|
Obviously the check which was removed by http://review.whamcloud.com/1131 is bogus. However, I'm wondering why we don't need to worry about overflow when fname is copied into lum in llapi_file_get_stripe(). strcpy((char *)lum, fname);
Is it just assumed that the caller of llapi_file_get_stripe() will ensure that lum is big enough to hold the last component of path? |