Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
8db2acde
Commit
8db2acde
authored
Feb 27, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: fix integer underflow in journal code
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
28062d32
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
fs/bcachefs/journal.c
fs/bcachefs/journal.c
+3
-1
fs/bcachefs/journal.h
fs/bcachefs/journal.h
+2
-0
No files found.
fs/bcachefs/journal.c
View file @
8db2acde
...
@@ -256,6 +256,8 @@ static int journal_entry_open(struct journal *j)
...
@@ -256,6 +256,8 @@ static int journal_entry_open(struct journal *j)
do
{
do
{
old
.
v
=
new
.
v
=
v
;
old
.
v
=
new
.
v
=
v
;
EBUG_ON
(
journal_state_count
(
new
,
new
.
idx
));
if
(
old
.
cur_entry_offset
==
JOURNAL_ENTRY_ERROR_VAL
)
if
(
old
.
cur_entry_offset
==
JOURNAL_ENTRY_ERROR_VAL
)
return
-
EROFS
;
return
-
EROFS
;
...
@@ -429,7 +431,7 @@ void bch2_journal_entry_res_resize(struct journal *j,
...
@@ -429,7 +431,7 @@ void bch2_journal_entry_res_resize(struct journal *j,
if
(
d
<=
0
)
if
(
d
<=
0
)
goto
out
;
goto
out
;
j
->
cur_entry_u64s
-=
d
;
j
->
cur_entry_u64s
=
max_t
(
int
,
0
,
j
->
cur_entry_u64s
-
d
)
;
smp_mb
();
smp_mb
();
state
=
READ_ONCE
(
j
->
reservations
);
state
=
READ_ONCE
(
j
->
reservations
);
...
...
fs/bcachefs/journal.h
View file @
8db2acde
...
@@ -292,6 +292,8 @@ static inline int journal_res_get_fast(struct journal *j,
...
@@ -292,6 +292,8 @@ static inline int journal_res_get_fast(struct journal *j,
if
(
new
.
cur_entry_offset
+
res
->
u64s
>
j
->
cur_entry_u64s
)
if
(
new
.
cur_entry_offset
+
res
->
u64s
>
j
->
cur_entry_u64s
)
return
0
;
return
0
;
EBUG_ON
(
!
journal_state_count
(
new
,
new
.
idx
));
if
(
flags
&
JOURNAL_RES_GET_CHECK
)
if
(
flags
&
JOURNAL_RES_GET_CHECK
)
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment